• 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: PopUp button + Controller Layer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PopUp button + Controller Layer


  • Subject: Re: PopUp button + Controller Layer
  • From: Raphael Sebbe <email@hidden>
  • Date: Wed, 12 Nov 2003 20:15:05 +0100

Exactly ! I could not figure out how to make selectedObject binding enabled (not grayed out) from IB. Starting from scratch, setting content & contentValues made it...

Thanks a lot.

Raphael

On 12 Nov 2003, at 19:57, mmalcolm crawford wrote:


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.

References: 
 >PopUp button + Controller Layer (From: Raphael Sebbe <email@hidden>)
 >Re: PopUp button + Controller Layer (From: mmalcolm crawford <email@hidden>)

  • Prev by Date: Re: PopUp button + Controller Layer
  • Next by Date: Re: NSBezierPath retain crash
  • Previous by thread: Re: PopUp button + Controller Layer
  • Next by thread: Re: PopUp button + Controller Layer
  • Index(es):
    • Date
    • Thread