• 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
Prevent windows from opening multiple times
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Prevent windows from opening multiple times


  • Subject: Prevent windows from opening multiple times
  • From: Luc Van Bogaert <email@hidden>
  • Date: Fri, 21 Jan 2011 19:48:19 +0100

Hi,

I've implemented a simple Preferences window using example code from a Cocoa handbook. When opening the window, the window controller is created and initialized with a nib file. When closing the window, the window object resources are (auto)released in the windowWillClose delegate method.

This seems to work fine, except for one problem: it is possible for the user to open multiple instances of the same window. I would like to prevent this, but I'm not sure what would be the best way to do this.

Instead of using a local pointer variable in the action method to open the window, I thought about using an instance variable in my app delegate to hold a pointer to the windowcontroller object, and check its existance before opening the window. However, trying this failed, as now I can open and close the window just once, and the app crashes on subsequent attempts to open the window.

Any help would be appreciated.
Thanks,

--
Luc Van Bogaert
email@hidden

_______________________________________________

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: Prevent windows from opening multiple times
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Magazine Framework
  • Next by Date: Re: NSBlockOperation with +[sendSynchronousRequest sendSynchronousRequest:...] or async?
  • Previous by thread: Re: Magazine Framework
  • Next by thread: Re: Prevent windows from opening multiple times
  • Index(es):
    • Date
    • Thread