Timers don't work in Modal window

Archives Forums/MacOS X Discussion/Timers don't work in Modal window

Brucey(Posted 2006) [#1]
*sniff*...

I have thrown together a "modal" module for the three platforms so that a single cross-platform method sets a window to modal.

Yes, that's right, there's no way to set a window to modal in Max natively (yet, I suppose).

Anyhoo... all seems to be well on win32... but on the Mac, a timer on a modal window NEVER fires...
I have a canvas on this window, and if I drag my mouse over it, it creates lots of mouse events. If I move the window I get events... but my Timer does nothing.

Am I right to presume that using runModalForWindow is somehow locking out the events generation for the timer?
I had thought that since the timer is created *inside* the modal window that it would work as normal...

The other option appears to be to use "runModalSession" instead, but that takes the loop out of max and puts it in Objective C... and I don't want to hack around with that only to find it doesn't work anyway ;-)

So, assuming I can't use a Timer (to force the refresh of my canvas), what other options do I have open to me?


@Mark : This cross-platform balancing act must do your head in !! :-p


Winni(Posted 2006) [#2]
Hi Brucey,

Isn't the concept of modal windows just one of those annoyingly bad habits of Windows applications?

Most Mac applications don't use modal dialogs, because they are not very "natural" to use and not necessarily user-friendly. So the question could be if one would even -want- such a thing on OS X.

But talking about timers... When do we get native multi-threading support in BlitzMax? I think we all would just love to have a real Thread class. ;-)


TartanTangerine (was Indiepath)(Posted 2006) [#3]
I found timers work but the resolution is way off. For example a 1Khz Timer is actually a 100Hz Timer.


ziggy(Posted 2006) [#4]

Isn't the concept of modal windows just one of those annoyingly bad habits of Windows applications?


No it's not. It's not a good idea to let the user change the preferences of an application while the application is runing regulary... (as instance). Most MacOs apps treat the preferences dialog in a modal way.