B4J Question Passing value to timer_tick event

kostefar

Active Member
Licensed User
Longtime User
Dear All,

To avoid defining values globally, is it possible to pass a value to a timer tick event?

I could of course create a do while loop that goes on and on till certain criterias are met, similar to disabling the timer.
I´m just so used to working with timers and thought it´d be optimal if I´d be able to pass a value over to one, as opposed to having a global value set.

Thanks in advance
 

DonManfred

Expert
Licensed User
Longtime User
is it possible to pass a value to a timer tick event?
no

But you can create a class.
Use the Timer in the class, use a class-variable inside the timer tick and at last you create a own Event for the timer tick event in the activity/service which uses the class and your class then raises this event. Here you can use your global variable (Class)
 
Last edited:
Upvote 0

Diceman

Active Member
Licensed User
I don't see any easy way to do it. Unfortunately the Timer does not have a Tag property.

You can of course create your own class which uses a Timer and you can add your own properties, methods, events etc.
The MyTimer class would have an event called MyTimer_Tick that gets called in the class and this event would then call the MyTimer1_Event (if it exists) in your mainline code and pass it the class instance as a parameter using the "me" variable. Your mainline code could then access this me parameter to get the class properties and methods etc..

This is relatively easy to do. (It should take you an hour)
 
Upvote 0

kostefar

Active Member
Licensed User
Longtime User
Thanks guys, I didn´t construct a class myself before from the ground but it sure would be a good experiment to progess in b4j, hence I´ll be looking around and pick up the pieces I need. Doesn´t sound superdifficult from what you´re telling.
 
Upvote 0
Top