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: Mon, 5 Apr 2004 02:14:56 -0500
What I do is to call this method at startup:
[[NSDocumentController sharedDocumentController] setShouldCreateUI:NO];
Then, I just create the window controllers myself when I'm ready to
display the document's window.
Someone may have a better solution - that's just what I do.
Charles
On Apr 5, 2004, at 1:11 AM, Christoffer Lerno wrote:
If I press New in the menu, it will issue a newDocument: in the
NSDocumentController, and the NSDocumentController in turn will
allocate(?) and initialize my ScenarioDocument (an NSDocument
subclass)... right?
Now where in this chain do I put the Panel to pass on the right
parameters to ScenarioDocument? Init doesn't accept any parameters, so
it's up to me to initialize those values after init. If I subclass
NSDocumentController I could set up something to stop newDocument from
initializing NSDocument and instead pass things over to the Panel
which in turn creates the NSDocument if all the arguments are nice?
/Christoffer
On Apr 5, 2004, at 12:16, Charles Srstka wrote:
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.
_______________________________________________
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.