Re: PopUp button + Controller Layer
Re: PopUp button + Controller Layer
- Subject: Re: PopUp button + Controller Layer
- From: mmalcolm crawford <email@hidden>
- Date: Wed, 12 Nov 2003 10:57:47 -0800
On Nov 12, 2003, at 9:30 AM, Raphael Sebbe wrote:
MALayer
.name (NSString)
.height (float)
MACurve
.layer (MALayer, not retained)
MADocument
.selectedCurve (MACurve)
.layers (NSMutableArray of MALayer)
Buimding the inspector, I want a popup that 1. shows all layers name
(document.layers) and that 2. selects the one from the selectedCurve.
For this, I create an NSObjectController for the selected curve and an
NSArrayController for the layers from Interface Builder. They are
respectively bound to App.mainWindow.document.selectedCurve and
App.mainWindow.document.layers .
1. works perfectly, by binding popup's contentValues to
arrayController.arrangedObjects.name . 2. seems to work too by binding
popup's selectedValue to objectController.layer, but when I put an
NSLog inside MACurve's setLayer:layer, I see that the passed "layer"
is actually a string (layer.name), not the layer itself...
What is the problem ? Do I need to use value transformers ?
No need for value transformers...
Bind the popup's *content* to arrayController.arrangedObjects;
bind the *contentValues* to arrayController.arrangedObjects.name;
bind the *selectedObject* to objectController.layer
The content defines what the collection of objects is. contentValues
allows you to define what attribute of the content will be *displyed*,
and the selectedObject obviously sets the selection...
mmalc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.