Re: Best way to implement a modal window
Re: Best way to implement a modal window
- Subject: Re: Best way to implement a modal window
- From: Charles Srstka <email@hidden>
- Date: Sun, 4 Apr 2004 23:16:23 -0500
On Apr 4, 2004, at 9:41 AM, Christoffer Lerno wrote:
For my editor, I'm planning on using NSDocument to structure things.
Now, being new to cocoa, I quickly ran into a small design problem.
It's not that I can't make it work, it's just that I want it to be a
good design too.
This is what is supposed to happen:
1. User clicks New in the menu
2. A modal window appears, asking for the width and height of the map
3. If width and height is correct, pressing the button labeled
"create" will close the modal window and open a new window laid out
with the requested width and height.
How do I design this best? For example, what class should be handling
the modal window's stopModal request?
My original design (before adding the modal window) looked like this:
ScenarioWindow (NSWindow)
ScenarioDocument (NSDocument subclass)
ScenarioWindowController (NSWindowController subclass)
Sure, I could put an action in ScenarioWindowController for my
NewDocumentPanel's "create" button to connect to when it wants to
close, but that doesn't seem like it's responsibility. Another way
could be to simply add that functionality to NSPanel, and yet another
to make a Controller for the panel (but that seems like overkill).
What's the best design?
There is no reason to use a modal window for this. Just use a plain old
window with the "Create" button set to finish making the document.
Charles
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.