• 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
awakeFromNib and sheets
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

awakeFromNib and sheets


  • Subject: awakeFromNib and sheets
  • From: Gary C Martin <email@hidden>
  • Date: Sat, 25 Aug 2001 01:49:57 +0100

Hi folks,

I had an unexpected problem with an NSBeginAlertSheet today related to the awakeFromNib method. My understanding was that awakeFromNib is called only once your applications nib file has been un-archived. I had assumed 'un-archived' meant that items such as windows from within the nib were ready to work with... However, I added an NSBeginAlertSheet as part of an error checking routine in my awakeFromNib method only to find that the sheet not only popped open in the wrong place but before the window it was attached to. Then, to add insult to injury, it is then mostly obscured by the window it should have been attached to the front of in the first place :o)

I've fixed the issue with what I think is a messy work-around (setting a instance variable error flag then using a windowDidBecomeKey delegate to trigger the sheet) but I wondered if I've made a basic incorrect assumption about awakeFromNibs.

My feeling now is that the awakeFromNib method is called for each item individually within the nib, one by one, as they are un-archived. So any one item within the nib should really check before interacting with any other items within it's parent nib.

Any hints?

A second issue I bumped into was similar to a list thread here a few days back. My above alert sheet has a default "Quit" and a "Try Again" option, where the "Try Again" re-tests the error condition and then re-opens another sheet if the problem is still there. To my surprise, user acknowledgment of a sheet does not immediately cause it sheet to close. In fact the 2nd sheet opens on top of the previous sheet before the first sheet decides to fold its self away.

Again I've fixed this issue with a less than elegant solution (set up a timer with a delay of 1 second that test for the error condition and if needed opens another error sheet).

Any hints?

Regards,
Gary


  • Follow-Ups:
    • Re: awakeFromNib and sheets
      • From: Mark T <email@hidden>
  • Prev by Date: Re: Docs
  • Next by Date: Re: awakeFromNib and sheets
  • Previous by thread: Re:NSBitmapImageRep compression...
  • Next by thread: Re: awakeFromNib and sheets
  • Index(es):
    • Date
    • Thread