• 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: Rainer Brockerhoff <email@hidden>
  • Date: Thu, 24 Jan 2002 22:25:07 -0200

>Date: Thu, 24 Jan 2002 15:05:44 -0500
>From: Michel Fortin <email@hidden>
>
>>> I've made a preference panel with a subclass of NSWindowController as
>>> the controller. In the nib file, the owner is set to my subclass. When
>>> the window controller loads the nib, owner's outlets do not get
>>> connected to to controls in the window. This is what I use to open the
>>> preference panel:
>>>
>>> - (IBAction)openPreferences:(id)sender {
>>> if ( prefs == nil )
>>> prefs = [[PreferenceWindowController alloc]
> >> initWithWindowNibName:@"Preferences"];
>>> [prefs showWindow:nil];
>>> }
> >>
>>> I've done it before in another app, but this one doesn't work and I
>>> can't find why. All actions are connected fine. I've even tried making
>>> the nib from scratch without success. Any ideas?
>>
>> NSWIndowController has an window outlet is that connected to the
>> correct window???
>>
>> vince
>
>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)


  • Follow-Ups:
    • Re: Nib owner's outlets
      • From: Michel Fortin <email@hidden>
    • Re: Nib owner's outlets
      • From: David Rehring <email@hidden>
  • Prev by Date: Re: Cocoa basic data types?
  • Next by Date: Re: How can I standardize a path name?
  • Previous by thread: Re: Nib owner's outlets
  • Next by thread: Re: Nib owner's outlets
  • Index(es):
    • Date
    • Thread