Best way to implement a modal window
Best way to implement a modal window
- Subject: Best way to implement a modal window
- From: Christoffer Lerno <email@hidden>
- Date: Sun, 4 Apr 2004 22:41:17 +0800
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?
/Christoffer
_______________________________________________
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.