[Gambas-user] Last in group event handler called as function
Benoît Minisini
gambas at ...1...
Mon Feb 6 20:53:19 CET 2012
Le 03/02/2012 21:13, tobias a écrit :
> hi,
>
> consider the following (where "PickColor" is the event name of a group
> of ToogleButton controls)
>
> Public Sub Form_Open()
> PickColor_Click()
> End
>
> Public Sub PickColor_Click()
> Print Last
> End
>
> since the event handlers are just subroutines one may call them as every
> other sub. i can imagine that Last is set properly for a single event
> raising object to avoid errors when the event handler uses Last but is
> not a risen event (i haven't looked at any event handler dispatcher code
> of the interpreter or something, so i don't know where Last is set). but
> what's about an event group? which object will Last be in this
> situation? in my code (which is, of course, a bit more complex) i always
> get the same ToggleButton printed but i can't spot any reason.
>
> regards,
> tobi
>
'Last' is the object that raised the event, whatever its "event group"
is. If you call the event handler directly, 'Last' will be Null, or
maybe the value of another control if you call it from another event
handler called regularly.
Regards,
--
Benoît Minisini
More information about the User
mailing list