View previous topic :: View next topic |
Author |
Message |
wahorger
Joined: 13 Oct 2014 Posts: 1225 Location: Morrison, CO, USA
|
Posted: Sat Sep 23, 2023 2:04 am Post subject: Attaching user data (%ud) to a delay timer (%dl) |
|
|
Is this permitted? Stated another way, is %dl a control in the classic sense?
Wanted to ask the question before I invested a lot of time.
I tried to use clearwin_info@('USER_DATA') like I had in other cases where a control had user data attached, and it was null().
Do I have to use "CALLBACK_CONTROL" to get the handle of the control to which the user data is attached (which I did not)?
Bill |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8011 Location: Salford, UK
|
Posted: Sat Sep 23, 2023 6:53 am Post subject: |
|
|
%dl doesn't create a control. It makes a call to the Microsoft API SetTimer for the given callback function.
The internal list of ClearWin+ timers could be extended to include a user data member but I don't know off hand how that would work out when retrieving the data. |
|
Back to top |
|
|
wahorger
Joined: 13 Oct 2014 Posts: 1225 Location: Morrison, CO, USA
|
Posted: Sat Sep 23, 2023 1:55 pm Post subject: |
|
|
Paul,
Thanks for confirming what I experienced when I tried to attach user data. I'm OK with simply getting the callback window handle to adjust the timer.
That said, the documentation says that a window can have multiple timers. How would one know which timer was activated, other than the callback function for the specific timer? And how would one alter the interval, or kill, a specific timer? I currently don't do anything like this, more curious than anything.
Bill |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8011 Location: Salford, UK
|
Posted: Sat Sep 23, 2023 3:31 pm Post subject: |
|
|
Bill
You can have multiple timers for a given parent window either with multiple %dl's or by adding timers at runtime. The routine SET_TIMER@ adds a new timer at runtime and KILL_TIMER@ removes a timer. KILL_TIMER@ passes the associated callback function as an argument in order to unquely identify the timer.
The routine CHANGE_TIMER_INTERVAL@ only works for the first %dl. Otherwise to change the delay it is necessary to call KILL_TIMER@ and then SET_TIMER@. |
|
Back to top |
|
|
wahorger
Joined: 13 Oct 2014 Posts: 1225 Location: Morrison, CO, USA
|
Posted: Sat Sep 23, 2023 8:30 pm Post subject: |
|
|
Thanks, Paul! I appreciate the information.
Bill |
|
Back to top |
|
|
|