[Gambas-user] prb:event programming
ron
ronstk at ...239...
Thu Apr 27 14:59:03 CEST 2006
I have a form Fnavbar
4 buttons in group
-------------------------
' Gambas class file
EVENT DoNavigation(sBtnTag AS String)
PUBLIC SUB _new()
ME.Show
timernavbtn = ""
TimerLock = FALSE
END
PUBLIC SUB Navigation_Click()
DIM ta AS String
ta = LAST.tag
PRINT "you clicked:" & ta <-- this works correct
RAISE DoNavigation("ta") <-- does not raise event
END
' below works for read/write
PRIVATE SUB Position_write(Position AS Integer)
txtPos.Text = Position
IF position = 4 THEN RAISE DoNavigation("pre") <-- this works not
END
PRIVATE FUNCTION Position_read() AS Integer
RETURN txtPos.Text
END
PRIVATE SUB Total_write(Total AS Integer)
txtTotal.Text = Total
END
PRIVATE FUNCTION Total_read() AS Integer
RETURN txtTotal.Text
END
----------------------------------
the main form
PRIVATE NavBar AS Fnavbar
STATIC PUBLIC FUNCTION Run() AS Boolean
DIM hForm AS Form
hForm = NEW Form1
RETURN hForm.ShowModal()
END
PUBLIC SUB _new()
NavBar = NEW Fnavbar AS "Browser"
END
PUBLIC SUB Browser_DoNavigation(sBtnTag AS String)
TimerNavBtn = ""
DoNavigation(sBtnTag)
END
---------------------------------
I found an example on a german wiki and created that one.
http://de.wikibooks.org/wiki/Gambas:_Event
at the bottom the example.
The event works here but it is a class that raise the event.
I try it from a form class.
Where to look for wrong thing?
More information about the User
mailing list