NSPanel as Sheet and controlling the run loop
NSPanel as Sheet and controlling the run loop
- Subject: NSPanel as Sheet and controlling the run loop
- From: "Alexander F. Hartner" <email@hidden>
- Date: Wed, 7 Apr 2004 16:38:55 +0200
My problem is the following:
I have a NSPanel which I created in InterfaceBuilder. It contains a
progress bar. The progress of the progress bar is controlled from a
while loop. Now I would like to display the NSPanel as a model sheet
via,
NSApplication * application = [NSApplication sharedApplication];
[application runModalForWindow:configPanel
relativeToWindow:AB4LDAPWindow];
this however puts my run loop to sleep until the sheet is dismissed,
which in turn only should happen when the process has completed.
[CATCH22]. What I have done now was to start my panel via:
NSApplication * application = [NSApplication sharedApplication];
NSModalSession session = [application
beginModalSessionForWindow:progressPanel];
..
for (..,..,..)
{
..
if ([application runModalSession:session] != NSRunContinuesResponse)
break;
..
}
..
[NSApp endModalSession:session];
[progressPanel close];
but now the panel doesn't run as a sheet and is positioned random /
centered on the screen. It is model however. Is there a way to run my
panel as a model sheet while continuing processing in the run loop.
I have tried the following so far:
-Using NSThread to display the panel. This caused a number of problems,
but I think there must be a nicer solution
-I guess one could inherit from NSPanel and create a new class which
has this funtionality
-In the delegate of the panel I tried to do the processing within the
various events received, but none seem to provide the correct
behavious.
Any suggestions welcome
alex
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.