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
luc.van.boga...@me.com  

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to