• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Having trouble with NSTimer and runModalForWindow
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Having trouble with NSTimer and runModalForWindow


  • Subject: Having trouble with NSTimer and runModalForWindow
  • From: Ricky Sharp <email@hidden>
  • Date: Sat, 14 Jan 2006 20:38:59 -0600

I need a timer to always run during the lifetime of my application. It runs about 10 times per second and is responsible for executing the next command in a script file. I use this script to test my app; basically simulates clicks on my controls along with other activities.

Anyhow, I create/add the timer like this:

NSTimer* theTimer = [NSTimer timerWithTimeInterval:IIScriptInterval target:self
selector:@selector(processNextCommand:) userInfo:nil repeats:YES];

[[NSRunLoop currentRunLoop] addTimer:theTimer forMode:NSDefaultRunLoopMode];
[[NSRunLoop currentRunLoop] addTimer:theTimer forMode:NSModalPanelRunLoopMode];


Now then, my app has one and only one window (think kiosk). The window's content changes over time. Whenever I need to display a "dialog", I render the "dialog's" content in that same window and then drop into a modal event loop via this:

int theModalValue = [NSApp runModalForWindow:[self contentWindow]];


But my timer never fires when I'm in the modal loop. This has me baffled as that's what NSModalPanelRunLoopMode is supposed to be for; to allow timers to run when in modal loops.


Has anyone successfully used timers like this? Note that my issue may have something to do with my having just one window. I may refactor things to put my "dialog" in a separate window to see if that makes any difference. But that's a bit of work that I'd like to hold off on if there's a simpler solution.

I'm currently running on 10.4.4


___________________________________________________________ Ricky A. Sharp mailto:email@hidden Instant Interactive(tm) http://www.instantinteractive.com

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Having trouble with NSTimer and runModalForWindow [Solved]
      • From: Ricky Sharp <email@hidden>
  • Prev by Date: how to make c++ calls from cocoa to a dynamic library
  • Next by Date: Is setting the class the same as setting a parent entity?
  • Previous by thread: Re: how to make c++ calls from cocoa to a dynamic library
  • Next by thread: Re: Having trouble with NSTimer and runModalForWindow [Solved]
  • Index(es):
    • Date
    • Thread