Welcome to MacBoardz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

What is [NSNibOutletConnector establishConnection]?

 
   Macintosh computer (Home) -> Programmer Help RSS
Next:  Getting pixel from CGImageRef  
Author Message
Florian Zschocke2

External


Since: Mar 29, 2004
Posts: 220



(Msg. 1) Posted: Wed Jan 09, 2008 5:58 pm
Post subject: What is [NSNibOutletConnector establishConnection]?
Archived from groups: comp>sys>mac>programmer>help (more info?)

Hello NG,

I have some trouble to add a checkbox to my nib.
I have a NSWindowContoller subclass for that nib.
I have added a IBAction method and connected it to the control.
I also added a NSButton outlet and connected it to the control.
The first ting funny is that my action method is called from the
[NSNibOutletConnector establishConnection] before awakeFromNib.
I did release the action - connection in the nib to avoid this, but
the IBAction-Method is still called before awakeFromNib.
After that I tried to check for the sender to a avoid the unwanted
calls, but the the sender is never the same id like the outlet, even
if I click the checkbox button. The same window has other checkboxes I
have added under Tiger ( Xcode 2.5) that don't show that behavior. I
also can't remember having seen [NSNibOutletConnector
establishConnection] before?
Something wrong with IB?

Thanx Florian

 >> Stay informed about: What is [NSNibOutletConnector establishConnection]? 
Back to top
Login to vote
Fritz Anderson

External


Since: Dec 01, 2007
Posts: 3



(Msg. 2) Posted: Thu Jan 10, 2008 7:05 am
Post subject: Re: What is [NSNibOutletConnector establishConnection]? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jan 9, 3:42 pm, Florian Zschocke wrote:

> Something wrong with IB?

Probably not. What you are reporting is almost certainly a frequently-
encountered trap in naming properties and IBOutlets.

> The first ting funny is that my action method is called from the
> [NSNibOutletConnector establishConnection] before awakeFromNib.

Suppose you have declared you button outlet thus:

IBOutlet NSButton * aProperty;

Is the button's action method

- (IBAction) setAProperty: (id) sender;

?

Refer to the documentation for -awakeFromNib :

> For each outlet that needs a connection, the NSNib object looks for
> a method of the form setOutletName: in your object. If that method
> exists, the NSNib object calls it, passing the target object as a
> parameter. If you did not define a setter method with that exact
> name, the NSNib object searches the object for an instance variable
> (of type IBOutlet id) with the corresponding outlet name and tries
> to set its value directly.

So when you NIB is loaded, and it comes time to connect your button to
the outlet, the NIB loader finds your setAProperty: method, and calls
it, rather than set the aProperty instance variable directly.

-- F

 >> Stay informed about: What is [NSNibOutletConnector establishConnection]? 
Back to top
Login to vote
Florian Zschocke2

External


Since: Mar 29, 2004
Posts: 220



(Msg. 3) Posted: Fri Jan 11, 2008 6:20 am
Post subject: Re: What is [NSNibOutletConnector establishConnection]? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Fritz Anderson schrieb:

> So when you NIB is loaded, and it comes time to connect your button to 
> the outlet, the NIB loader finds your setAProperty: method, and calls 
> it, rather than set the aProperty instance variable directly. 

Ahh, I did not know this.
I'm surprised that I did not tap into this fault before.

Thanx a lot

Florian
 >> Stay informed about: What is [NSNibOutletConnector establishConnection]? 
Back to top
Login to vote
Florian Zschocke2

External


Since: Mar 29, 2004
Posts: 220



(Msg. 4) Posted: Fri Jan 11, 2008 12:26 pm
Post subject: P.S.: Re: What is [NSNibOutletConnector establishConnection]? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Fritz Anderson schrieb:

> So when you NIB is loaded, and it comes time to connect your button to 
> the outlet, the NIB loader finds your setAProperty: method, and calls 
> it, rather than set the aProperty instance variable directly. 

What could I do with this behavior? Could I replace the hole NSControl
with a different control?
Could you tell me a scenario where this could be useful?

Thanx Florian.
 >> Stay informed about: What is [NSNibOutletConnector establishConnection]? 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
memory leaking in 10.2.8? - Hi groups, I have a question concerning the memory management in the OS X (10.2.8 to be exact). Either I don't understand the way it works or there is something like major memory leak in the version I referred to (I haven't noticed it with previous..

Question about Bindings and Archiving - I'm referring to the tutorial "Enhanced Currency Converter" (from ADCHome > Documentation > Cocoa > Design Guidelines > Cocoa Bindings. I did it . Works great. Now I'm trying to make it save and open files (since it is based on an N...

Post encodeWithCoder stall? (archiving large graphs part 3) - In order to save large and tangled graphs without getting recursive unarchiving I decided to take the graph apart and archive it in the form of a series of linear arrays. What I have now are two linear arrays holding the elements of the graph. The..

Problem under Panther with NSView: dataWithEPSInsideRect a.. - Hi, our problem comes down to this: We do some painting in a custom view (lines and such) and also have some text (via NSFont -fontWithName and -drawAtPoint). The data is then pulled from the view with dataWithEPSInsideRect and written to an EPS file....

XCode - help ! - Is it possible to build a PEF executable using XCODe ? ( any methods ) or is that ONLY Macho-o's could be developed using Xcode ?? <font color=purple> ;> rG.</font> -- macro --------------------------------------------------------...
   Macintosh computer (Home) -> Programmer Help All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]