Re: How does an instance variable in the ObjC code get connected to an interface element in the NIB file? BACK ON TRACK

2008-06-17 Thread Paul Archibald
Well, Erik, you know that sometimes we inherit working code without  
knowing much about its history. I don't want to break something that  
already works (and ships), and re-factoring the whole codebase is not  
part of my charter. I am trying to add my stuff without disturbing  
the working app. I think I will be moving a lot of the outlets that  
concern my module, but as for the rest ...


If it ain't broke, don't fix it.

(The message thread you mention looks like a rich source. I will have  
to read the whole thing. I have only been on the forum a couple of  
weeks, and I am running to catch up.)


On Jun 17, 2008, at 12:37 AM, [EMAIL PROTECTED] wrote:

Over 130 outlets! Holy Sassafras Tea!  That is ten to fifteen times  
more outlets than I have ever seen in a single class in 20 years of  
Objective-C programming!


  I suspect you are doing something very wrong.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: How does an instance variable in the ObjC code get connected to an interface element in the NIB file? BACK ON TRACK

2008-06-16 Thread Erik Buck
Over 130 outlets! Holy Sassafras Tea!  That is ten to fifteen times more 
outlets than I have ever seen in a single class in 20 years of Objective-C 
programming!
   
  I suspect you are doing something very wrong.
   
  First, use the Model-View-Controller pattern.  Don’t store application state 
or Model data in the View.
   
  Second, use patterns like “data source” and objects like NSTableView and 
NSMatrix and NSColectionView to structure user interfaces that require lots of 
objects.
   
  Regarding the original question: “How does an instance variable in the ObjC 
code get connected to an interface element in the NIB file?”
   
  I was hoping someone would point out the answer that was provided in this 
forum one month before this question was asked (again):
  http://www.cocoabuilder.com/archive/message/cocoa/2008/5/15/206771
   
   
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: How does an instance variable in the ObjC code get connected to an interface element in the NIB file? BACK ON TRACK

2008-06-16 Thread Paul Archibald
Okay, I see them now. I was missing them in the rather long list of  
outlets (over 130!) for the main controller.


I wanted to understand this better because I want to re-factor the  
code so that there are NOT 135 outlets for one controller. Currently  
we have two windows that handle different tasks, but share the  
controller. I want separate controllers for each window/task.


Thanks, Ken.


On Jun 13, 2008, at 6:22 PM, Ken Thomases wrote:


On jun 13, 2008, at 4:21 PM, Paul Archibald wrote:

This puzzles me. I am tracing through some code in which I am  
looking at the value of some selected popup menu items. I am  
seeing the correct values for them, but I have to confess I don't  
know how the code is connected to the popup, or just why the code  
even works! I see the connections for the buttons on the  
interface, and I hit the breakpoints I expect, but I don't see any  
connections between the member variables and the popup items.


There are instance vars for the popups in the code, but I don't  
see how they are connected to the NIB.


It sounds to me like you're not familiar with "outlets", which is a  
pretty basic part of Cocoa GUI design.  You probably need to review  
the conceptual documentation:


http://developer.apple.com/documentation/Cocoa/Conceptual/ 
CocoaFundamentals/


http://developer.apple.com/documentation/Cocoa/Conceptual/ 
CocoaFundamentals/CommunicatingWithObjects/ 
chapter_6_section_3.html#//apple_ref/doc/uid/TP40002974-CH7-SW3


Regards,
Ken



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: How does an instance variable in the ObjC code get connected to an interface element in the NIB file?

2008-06-13 Thread Jens Alfke


On 13 Jun '08, at 2:21 PM, Paul Archibald wrote:

This puzzles me. I am tracing through some code in which I am  
looking at the value of some selected popup menu items. I am seeing  
the correct values for them, but I have to confess I don't know how  
the code is connected to the popup, or just why the code even works!  
I see the connections for the buttons on the interface, and I hit  
the breakpoints I expect, but I don't see any connections between  
the member variables and the popup items.


It happens when the nib is loaded. As the objects in the nib get  
created, their instance variables are set up to point to each other as  
described in the nib. This even applies to your controller object (the  
one that "owns" the nib), which exists before the nib is loaded —  
AppKit uses Obj-C introspection to look up its instance variables  
dynamically and change them to point to the objects from the nib.


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Re: How does an instance variable in the ObjC code get connected to an interface element in the NIB file?

2008-06-13 Thread Ken Thomases

On jun 13, 2008, at 4:21 PM, Paul Archibald wrote:

This puzzles me. I am tracing through some code in which I am  
looking at the value of some selected popup menu items. I am seeing  
the correct values for them, but I have to confess I don't know how  
the code is connected to the popup, or just why the code even  
works! I see the connections for the buttons on the interface, and  
I hit the breakpoints I expect, but I don't see any connections  
between the member variables and the popup items.


There are instance vars for the popups in the code, but I don't see  
how they are connected to the NIB.


It sounds to me like you're not familiar with "outlets", which is a  
pretty basic part of Cocoa GUI design.  You probably need to review  
the conceptual documentation:


http://developer.apple.com/documentation/Cocoa/Conceptual/ 
CocoaFundamentals/


http://developer.apple.com/documentation/Cocoa/Conceptual/ 
CocoaFundamentals/CommunicatingWithObjects/chapter_6_section_3.html#// 
apple_ref/doc/uid/TP40002974-CH7-SW3


Regards,
Ken
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: How does an instance variable in the ObjC code get connected to an interface element in the NIB file?

2008-06-13 Thread Robert Martin

Hint: If you want to ask a question about your code, we're not psychics


On Jun 13, 2008, at 5:21 PM, Paul Archibald wrote:


Comrades:

This puzzles me. I am tracing through some code in which I am  
looking at the value of some selected popup menu items. I am seeing  
the correct values for them, but I have to confess I don't know how  
the code is connected to the popup, or just why the code even works!  
I see the connections for the buttons on the interface, and I hit  
the breakpoints I expect, but I don't see any connections between  
the member variables and the popup items.


There are instance vars for the popups in the code, but I don't see  
how they are connected to the NIB.



Paul
(I hope I didn't already ask this question!)
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/robmartin%40frontiernet.net

This email sent to [EMAIL PROTECTED]



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


How does an instance variable in the ObjC code get connected to an interface element in the NIB file?

2008-06-13 Thread Paul Archibald

Comrades:

This puzzles me. I am tracing through some code in which I am looking  
at the value of some selected popup menu items. I am seeing the  
correct values for them, but I have to confess I don't know how the  
code is connected to the popup, or just why the code even works! I  
see the connections for the buttons on the interface, and I hit the  
breakpoints I expect, but I don't see any connections between the  
member variables and the popup items.


There are instance vars for the popups in the code, but I don't see  
how they are connected to the NIB.



Paul
(I hope I didn't already ask this question!)
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]