Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Callbacks and Timers » how to use timer id? and how to kill a timer
Re: how to use timer id? [message #27495 is a reply to message #27480] Wed, 21 July 2010 10:46 Go to previous messageGo to previous message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
First question:
The enum is to ensure that you don't use ids that are already used by your base classes. For instance, if TopWindow had:
enum { TIMEID_TIMER1 = Ctrl::TIMEID_COUNT,
TIMEID_TIMER2,
TIMEID_TIMER3,
TIMEID_COUNT };

and your class
enum { TIMEID_PERIODIC_TIMER = TopWindow::TIMEID_COUNT,
TIMEID_COUNT };

Then TIMEID_PERIODIC_TIMER would be 3, and TopWindow would use ids 0,1,2. In practice I've never found a situation where this is a problem but it's good practice and not much work.

Second question:
I'm not 100% sure I understand you, but in this situation I would just pass a Callback the the Thread as a parameter. The Thread can then execute the Callback when it's ready to create the timer.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Time callbacks when ticks overlap
Next Topic: Callbacks with 'Disable' feature
Goto Forum:
  


Current Time: Wed Aug 27 14:27:26 CEST 2025

Total time taken to generate the page: 0.05916 seconds