[Gambas-user] behaviour of Last + Timer events
richard terry
rterry at ...1946...
Sun May 10 02:16:31 CEST 2009
I got caught recently with a bug - many many weeks to uncover it, until I did
by random chance - a mix-up of what actually was 'Last'. So my question
basically is how Gambas determines what is 'Last'.
I often use 'Last' in subroutines where I may have several controls which are
the same, and I have a common group eg say combo1,2,3, , where the group name
is say my_combos where each control has a tag, here lets
say "one", "two", "three"
The code could be
public sub my_combos_click()
Select case last.tag
case "one"
do somthing
case "two"
do something
case "three"
do something
end select
As a result of whatever code I have in 'do something' I may then again
reference Last:
something else = Last.text
end
Now, what was happening in my program that on the main form - not the form
that I had the bug on - I had a timer, which was firing every 10 minutes.
when my program crashed unexpectedly at one point, I inspected the properties
and found that the 'Last' referenced had ceased to be the 'Last' in my
subroutine, but had become the 'Last' control that fired an event - suddenly
the Timer on another form.
As it turned out when I checked my code - it was my fault anyway - faulty
code, but it made me want to ask the question about how Gambas defines what
is Last. Seems to be a system-wide property - not just the last thing on a
particular form.
Any observations/comments.
Regards
Richard
More information about the User
mailing list