• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Best way to implement a modal window
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Follow-Ups:
    • Re: Best way to implement a modal window
      • From: Charles Srstka <email@hidden>
    • Re: Best way to implement a modal window
      • From: Public Look <email@hidden>
  • Prev by Date: Warning about NS_DURING (was "Bug in Cocoa drawing?")
  • Next by Date: Re: app crash when click on window
  • Previous by thread: Re: app crash when click on window
  • Next by thread: Re: Best way to implement a modal window
  • Index(es):
    • Date
    • Thread