I thought that this had been hashed previously, but I can’t find anything searching the forum.
Given a Timer on a Window, is it possible to call the Timer and pass a parameter/argument to the timer?
Or, do I have to use a properly scoped variable?
I thought that this had been hashed previously, but I can’t find anything searching the forum.
Given a Timer on a Window, is it possible to call the Timer and pass a parameter/argument to the timer?
Or, do I have to use a properly scoped variable?
Or you could subclass Timer and add a property. I did that with TCPSocket to add information specific to the connection such as user name.
in which case it still becomes a “properly scoped variable”… just a different scope is all
Yeah. Or you could alter the constructor.
[quote=346132:@Tim Jones]I thought that this had been hashed previously, but I can’t find anything searching the forum.
Given a Timer on a Window, is it possible to call the Timer and pass a parameter/argument to the timer?
Or, do I have to use a properly scoped variable?[/quote]
Not sure exactly what this means to be honest
None of the methods on a timer accept parameters - so you can call them with params
And none of the events are raised with params - so there’s nothing there
The best you could do it set one of the properties
beyond that I’m honestly sure what you mean by “call the Timer and pass a parameter/argument to the timer” ?
Ding, Ding, Ding, Ding! We have a winner. I KNEW I’d seen this discussed previously.
Thanks, Jim!
the delegate you call takes no params
now you could set up a “global” variable and have the no param method use that etc
[quote=346192:@Norman Palardy]the delegate you call takes no params
now you could set up a “global” variable and have the no param method use that etc[/quote]
According to the docs, I should be able to do:
Using xojo.core
Dim myTimer As New Timer
Dim myDict As New Dictionary
// fill in the dictionary pairs
myTimer.CallLater(5, AddressOf(myUpdateFunction), myDictionary)
uh yeah the second form of call later
duh
thats what I get for answering off the top of my head
[quote=346198:@Norman Palardy]uh yeah the second form of call later
[/quote]
You had me going there for a second since it seemed to work