• 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
Re: NSWindow delegate messages question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSWindow delegate messages question


  • Subject: Re: NSWindow delegate messages question
  • From: Graham Cox <email@hidden>
  • Date: Sat, 19 Dec 2009 00:13:38 +1100

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@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSWindow delegate messages question
      • From: "Alexander Bokovikov" <email@hidden>
References: 
 >NSWindow delegate messages question (From: "Alexander Bokovikov" <email@hidden>)

  • Prev by Date: Intercepting events and touches in UIPickerView subclasses? (or, WTF is going in the UIPickerView's responder chain?)
  • Next by Date: Subview and window size
  • Previous by thread: NSWindow delegate messages question
  • Next by thread: Re: NSWindow delegate messages question
  • Index(es):
    • Date
    • Thread