On Sep 3, 2005, at 1:53 PM, Ludwig Villiger wrote:
When I close the window of my Cocoa-App I can not reopen it with
the Menu "New". Is there a easy why to tell the Computer, that he
should reopen the window?
Greetings!
Ludwig
Document-based apps automatically handle the New menu (opening a new
document window) and also handle the Window menu like you mentioned.
But that means it needs to make sense for your app to support more
than 1 window open at a time. If your app is a single-window based
app, I believe you'll have to set that up yourself.
The quick-and-dirty solution is to bind the New menu item to the -
makeKeyAndOrderFront target on the window in IB. Though this is
probably confusing and non-standard behavior for Cocoa apps, since
when your window is already open, New will still be active but will
do nothing. I believe the better solution is to add your own method
that you bind to the New menu item, that is disabled when the window
is open, and once it's closed, it becomes enabled, and it calls -
makeKeyAndOrderFront on your window instance. Though I have only done
Document-based apps, so I'm unfamiliar with single-window apps.
You might want to take a look at an open-source app that behaves like
you want and see how they do it, or look at the examples in /
Developer/Examples/AppKit.
Good luck,
Logan Allred
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Student-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/student-dev/email@hidden