Re: Enumerating outlets automatically?

2008-11-06 Thread Michael Ash
On Thu, Nov 6, 2008 at 2:16 PM, Andy Lee <[EMAIL PROTECTED]> wrote: > Ah, I see. When you said setFoo: I was thinking of the setEnabled: message > that Graham wanted to send to all the objects, but you meant the > setMyOutlet1:, setMyOutlet2:, etc. messages that are (we think) sent when > the nib

Re: Enumerating outlets automatically?

2008-11-06 Thread Boyd Collier
With some trepidation resulting from my lack of expertise, especially relative to those who have already offered suggestions, here is bit of code showing (a somewhat simplified version of) what I do. "self" in the next-to-last line refers to a controller. In the header for the controller,

Re: Enumerating outlets automatically?

2008-11-06 Thread Andy Lee
On Nov 6, 2008, at 12:50 PM, Michael Ash wrote: On Thu, Nov 6, 2008 at 12:15 PM, Andy Lee <[EMAIL PROTECTED]> wrote: Lastly, you could write a proxy object, put it in your nib, and hook up all of the outlets to it instead. The proxy would intercept all setFoo: messages by forwarding them to you

Re: Enumerating outlets automatically?

2008-11-06 Thread Erik Buck
See http://www.cocoabuilder.com/archive/message/cocoa/2002/6/16/69399   Just put an array in you nib.  Connect all of the objects of interest to the array.  In you controller code, use one outlet to the array. ___ Cocoa-dev mailing list (Cocoa-dev@lists

Re: Enumerating outlets automatically?

2008-11-06 Thread Michael Ash
On Thu, Nov 6, 2008 at 12:15 PM, Andy Lee <[EMAIL PROTECTED]> wrote: > On Nov 6, 2008, at 11:27 AM, Michael Ash wrote: >> >> On Thu, Nov 6, 2008 at 12:13 AM, Graham Cox <[EMAIL PROTECTED]> >> wrote: >>> >>> Is there a way to enumerate the outlets of an object automatically? >>> >>> In a certain typ

Re: Enumerating outlets automatically?

2008-11-06 Thread Andy Lee
On Nov 6, 2008, at 11:27 AM, Michael Ash wrote: On Thu, Nov 6, 2008 at 12:13 AM, Graham Cox <[EMAIL PROTECTED]> wrote: Is there a way to enumerate the outlets of an object automatically? In a certain type of controller object I'm finding I'm writing a lot of code like this: [myOutlet1 setE

Re: Enumerating outlets automatically?

2008-11-06 Thread Michael Ash
On Thu, Nov 6, 2008 at 12:13 AM, Graham Cox <[EMAIL PROTECTED]> wrote: > Is there a way to enumerate the outlets of an object automatically? > > In a certain type of controller object I'm finding I'm writing a lot of code > like this: > > [myOutlet1 setEnabled:NO]; > [myOutlet2 setEnabled:NO]; > ..

Re: Enumerating outlets automatically?

2008-11-06 Thread Matt Neuburg
On Thu, 6 Nov 2008 16:13:52 +1100, Graham Cox <[EMAIL PROTECTED]> said: >Is there a way to enumerate the outlets of an object automatically? > >In a certain type of controller object I'm finding I'm writing a lot >of code like this: > >[myOutlet1 setEnabled:NO]; >[myOutlet2 setEnabled:NO]; >... etc

Re: Enumerating outlets automatically?

2008-11-06 Thread Andy Lee
On Nov 6, 2008, at 12:13 AM, Graham Cox wrote: [myOutlet1 setEnabled:NO]; [myOutlet2 setEnabled:NO]; ... etc for another several dozen outlets ... If I could get a list of outlets How about using introspection to get the ivars and see which ones are objects that respond to -setEnabled:? --

Re: Enumerating outlets automatically?

2008-11-05 Thread Graham Cox
On 6 Nov 2008, at 4:26 pm, David Duncan wrote: If the 'enabled' state of all these objects are effectively tied to a particular state, then why not use bindings? You could bind the enabled state of these controls to a property of your controller object and then you just set the property an

Re: Enumerating outlets automatically?

2008-11-05 Thread David Duncan
On Nov 5, 2008, at 9:13 PM, Graham Cox wrote: Is there a way to enumerate the outlets of an object automatically? In a certain type of controller object I'm finding I'm writing a lot of code like this: [myOutlet1 setEnabled:NO]; [myOutlet2 setEnabled:NO]; ... etc for another several dozen o

Enumerating outlets automatically?

2008-11-05 Thread Graham Cox
Is there a way to enumerate the outlets of an object automatically? In a certain type of controller object I'm finding I'm writing a lot of code like this: [myOutlet1 setEnabled:NO]; [myOutlet2 setEnabled:NO]; ... etc for another several dozen outlets ... If I could get a list of outlets (ma