• 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
Re: Multiple Window Application...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple Window Application...


  • Subject: Re: Multiple Window Application...
  • From: "M. Uli Kusterer" <email@hidden>
  • Date: Sun, 5 Oct 2003 16:38:09 +0200

At 19:23 Uhr -0500 04.10.2003, James McConnell wrote:
Just so you all know where I'm coming from, I'm originally a Java developer,
and I plain got sick of having to struggle to come up with nice looking
interfaces, so I'm looking at Cocoa, and yes, I will stick with Objective-C,
not Cocoa/Java.

Smart decision.

Now, in Cocoa, all the examples I've seen involve small projects with only
one window. You create it in IB, create a controller class that contains
all the outlets and actions. How would I handle more than one window?

Let me summarize the gist of the answers you received in the thread archived at
http://cocoa.mamasam.com/COCOADEV/2003/09/1/72552.php
for posterity:

-> Create both windows in a NIB file
-> Give the file's owner owner an outlet pointing to your second window (You should already have an outlet hooked up to the first window).
-> Make sure the second window is marked as initially invisible (visible at startup checkbox to OFF, or whatever the exact name is)
-> Make sure the second window is checked not to be released when closed (it will only be hidden, i.e. orderOut: will be called on it)
-> When you want to show the window, use the outlet to get at the window to set up its initial values, and use orderFront: or makeKeyAndOrderFront: to actually show it.

This will obviously work only if you want a single window. If you want to open several windows of this style independently, you should look into document-based applications, making the main window a list of files that opens documents for each file.

If there is no relationship between these windows and files, you should look into subclassing an NSWindowController, or using NSNibLoading directly to fake the behavior of NSDocument and NSWindowController for your special case.
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
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.
References: 
 >Multiple Window Application... (From: James McConnell <email@hidden>)

  • Prev by Date: Re: Multiple Window Application...
  • Next by Date: Re: stop and wait
  • Previous by thread: Re: Multiple Window Application...
  • Next by thread: Special Characters printed to the console
  • Index(es):
    • Date
    • Thread