• 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: Nib owner's outlets
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Nib owner's outlets


  • Subject: Re: Nib owner's outlets
  • From: Michel Fortin <email@hidden>
  • Date: Sat, 26 Jan 2002 15:45:46 -0500

-----------
Note: I sent this via the wrong account, and got a message saying it would be moderated before being sent to the list. A day has passed and I've not received anything, so I resent it. Sorry if you get it twice.
-----------

Ok, here is what happen when I call [prefs window] or [prefs showWindow:nil] (the first time I call one of these two). Using [prefs window] first has no effect.

1. The nib loads, and while loading calls one of my custom action method. (strange, don't you think?) Outlets are not connected.
2. -windowDidLoad is called in my PreferenceWindowController class. Outlets are not connected.
3. It returns to initial caller of -window or -showWindow, my -openPreference method. Outlets are still not connected.

This may be useful, the selector hierarchy is as follows while calling my action in step 1:
0 -[PreferenceWindowController myActionMethod:]
1 -[NSObject performSelector:withObject:]
2 -[NSIBObjectData nibInstantiateWithOwner:topLevelObject:]
3 -[NSRTFReader dealloc]
4 +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:]
5 +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:]
6 -[NSWindowController loadWindow]
7 -[NSWindowController window]
8 -[MyAppController openPreferences:]
... and so on...

What the hell is doing NSRTFReader here? I've no text field of any kind anywhere in my application.

Well, any help is appreciated, I now set my outlets manually in the -windowDidLoad method using view tags... and it works.

Michel Fortin
Student at Universiti Laval, Quibec
email@hidden

Rainer Brockerhoff a wrote :

It seems that the Window outlet from the superclass gets connected correctly when loading the nib since the window shows up. But my others custom outlets do not. My custom actions are connected fine. I'm thinking of accessing my window elements by tag as a workaround... but I can't still figure out why it is not working.

Try this:
initWithWindowNibName:@"Preferences"];
[prefs window]; // inserted
[prefs showWindow:nil];


I used to have the same problem under those circumstances, and inserting this line always connects the outlets. You can check by placing a breakpoint there and single-stepping.

There is, of course, an explanation for this, but space precludes giving it here (actually, meaning, it's from the wave-a-dead-chicken-school-of-voodoo-programming, but it works somehow ;-)).

--
Rainer Brockerhoff <email@hidden>
Belo Horizonte, Brazil
"I love deadlines. I love the whooshing noise they make as they go by" (Douglas Adams)
http://www.brockerhoff.net/ (updated Jan. 2002)


References: 
 >Re: Nib owner's outlets (From: Rainer Brockerhoff <email@hidden>)

  • Prev by Date: Sample code - building an Apple Event in a Cocoa application?
  • Next by Date: Re: Rebuilding Precompiled headers
  • Previous by thread: Re: Nib owner's outlets
  • Next by thread: Re: Nib owner's outlets
  • Index(es):
    • Date
    • Thread