Re: Working with sheets...
Re: Working with sheets...
- Subject: Re: Working with sheets...
- From: Fritz Anderson <email@hidden>
- Date: Tue, 9 Dec 2003 12:20:20 -0600
This is brainstorming at the keyboard...
Your controller class is the owner of an NSPanel, which is the sheet.
The controller's designated initializer takes the parent window as a
parameter, saves it, and loads the panel's nib.
A separate run method starts the task and the monitor thread. It then
does beginSheet:modalForWindow:... / runModalForWindow: ... / endSheet:
/ [panel close].
During rubModalForWindow:, events come in from the thread
asynchronously, and the controller's action methods get fired by
controls in the sheet. (I am, off the top of my head, unclear on
whether the runloop mode for the sheet would lock out the DO
notifications. My guess is not, but it's a potential bug to watch for.)
If the user cancels, tell the thread to kill the task and return from
its loop, and send [NSApp stopModal]. If the task completes, have the
thread return after calling a DO method on the controller's main thread
that will send [NSApp stopModal].
The run method returns. Various status will be left in the controller
object for you to harvest. So far as the controller's client is
concerned it looks like:
controller = [[Controller alloc] initWithParent: window ...];
[controller run];
information = [controller getWhatever];
[controller release];
-- F
On 9 Dec 2003, at 7:55 AM, Huyler, Christopher M wrote:
Simple:
If I create a window that I want to display as a sheet. How can I have
a section of code run when the sheet is displayed?
Complex:
The user presses a button which creates a separate thread to launch an
external application. The application sends updates back to the
separate thread, which then relays the messages (via DO) to the main
controller class. I want to pop up a sheet when the user presses this
button and have the sheet (and its controller) do all this work instead
of the main controller class. That way, the user cannot do anything
else until the process has finished.
Is this possible?
--
Christopher Huyler
Computer Associates Intl.
mailto:email@hidden
_______________________________________________
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.
_______________________________________________
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.