Stacking run loops
Stacking run loops
- Subject: Stacking run loops
- From: Ricky Sharp <email@hidden>
- Date: Wed, 15 Dec 2004 19:48:39 -0600
I've got a non-typical app (kiosk) that has one and only one window.
The contents of the window are what I call a "screen".
For the sake of discussion, let's say there are only two screens:
"main" and "about dialog".
Upon app startup, the main screen UI is presented and managed by a
controller. When the "about" button is clicked, I want to "run" the
about dialog, but do so with a blocking call.
Here are two methods I've implemented in my app controller:
- (void)runDialogScreen:(int)aScreenID
{
[self pushScreen:aScreenID];
CFRunLoopRun();
[self popScreen];
}
Here, pushScreen: will load a nib for the given screen ID. That nib's
owner is a controller for that particular screen (in this case the
about dialog).
After the nib is loaded, the main window's content view is replaced
with the content view from a well-named panel object in the nib (the
about dialog UI).
The controller for the about dialog then has an IBAction for
okButtonPressed. In that method, I call the app controller's
endDialogScreen:
- (void)endDialogScreen
{
CFRunLoopStop ([[NSRunLoop currentRunLoop] getCFRunLoop]);
}
As you can see, the thought it to push the about screen, block and
process events, then after the loop is stopped, the about screen is
popped. This will then reload the original controller/nib in my screen
stack (the main screen for this example).
Problem: CFRunLoopRun is returning immediately. Note that this is
supposed to be functionally equivalent to [[NSRunLoop currentRunLoop]
run].
I've been trying to search for potential examples of stacked run loops,
but have come up empty.
The docs, while very detailed, are a bit confusing to me. It explains
without a doubt that run loops can be stacked and it makes it sound
like you just would need to do a CFRunLoopRun. But it also explains
that if it returns immediately, that there are no input sources to
process.
Does one have to figure out what input sources to add to a nested
(stacked) run loop? I had thought that running the current run loop
using the default mode was suppose to do this for you.
Any examples or pointers on how to effectively stack run loops would be
greatly appreciated.
___________________________________________________________
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