On 18/12/2009, at 10:12 PM, Alexander Bokovikov wrote:
> I'd like to launch some process (no matter what exactly, it will work in
> different thread) as soon this popup panel will appear on screen. Of course,
> I could launch this process from within the same click handler above, but I
> believe it will be better to do it all in the WindowController's module,
> related to the popup panel. My question is: what window delegate message
> should I use? Will it be OK to use windowDidBecomeKey message or should I use
> windowDidExposed? Or whatever else?
>
> Another question is what notification could I use to display an alert box,
> appearing _after_ this popup window will disappear from screen? For example,
> I have a "Cancel" button on this popup panel, which should terminate the
> launched process and (as a result of NSTask termination notification) panel
> should be closed. For the sake of simplicity let's imagin, we're closing the
> panel by button directly:
>
> - (IBAction) btnCancelClick:(id)sender {
> [[self window] close];
> }
>
> My question is: what window delegate message should I use to show an NSAlert,
> in order my alert box would appear on screen already _after_ hiding of the
> popup panel? As far as I can see, there is no windowDidClosed message, but
> there is only windowWillClose. Is there any easy solution here?
There is an easy solution - do it in your window controller. Since it is
responsible for opening and closing the windows, it knows when to cause these
other events as well. I wouldn't use window activation or key notifications
since that relates purely to its appearance which likely as not has nothing to
do with your logic as such - the window coming up and going away are further
effects of this logic, not its causes.
--Graham
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]