On Aug 9, 2007, at 9:00 AM, Andreas Falkenhahn wrote:
I found out that when a timer fires, no event is generated. I.e. the
call to
ReceiveNextEvent() in waitevents() correctly executes my TimerUPP
but it does not return
control to the main loop after running the TimerUPP.
To get this behaviour, I'm now sending a dummy event from my
TimerUPP to the
event handler just to make ReceiveNextEvent() return. So in my
TimerUPP I'm
doing the following:
This works fine so far, but as I'm new to Mac OS X programming, I
would like to ask the
experienced developers out there if my solution is "okay" to get the
desired behaviour, or
if it could be done in a nicer way. Any feedback on this solution is
appreciated.
There's a better way: use QuitEventLoop( GetMainEventLoop() ) from
within your timer function. This will cause the ReceiveNextEvent call
to return immediately.
On a side note: How do I make sure that my dummy event is unique? Of
course, I
can create it with code like this:
But who guarantees that Apple does not use event class 'abcd' and
event kind 'efgh'
in a future version for new events? Is there any method to get a
unique event class?
There's no built-in way to get a unique event class, but Apple
guarantees that its four-character constants will always use lower-
case characters. If you use four-char constants that don't use lower-
case chars, then you won't conflict with any future standard constants.
-eric
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden