On Oct 30, 2008, at 20:38, Mike Laurence wrote:

Thanks for the suggestion, but I need to be able to set the contents of the
cell (e.g., the labels of the different buttons) before the selected
index/tag/label is of any use.

With a data source, the cell received a 'setObjectValue' call with an array
of items, each corresponding to a different button, so it was easy to
iterate over said array and assign the buttons in one quick gesture.

With bindings, every other type of cell (?) has a 'value' binding which corresponds to the same setObjectValue method, which is called automatically when the data is populated into my underlying array. But NSSegmentedCell lacks it completely - perhaps I have to subclass it and add my own bindings?
I haven't done that before, but I guess I'll give it a shot.

If anyone has had any experience with the NSSegmentedCell in a bindings
fashion, please let me know what steps you took to get it working.

There's no requirement that a bindable object have a "Value" binding. It's just a convention that most things having a single value use.

NSSegmentedCell happens to have 3 bindings: "Selected Index", "Selected Label" and "Selected Tag". You can only bind one of them, and it determines which of 3 possible ways of identifying the current segment your application chooses to use (index, name or label, tag).

You enter the segment labels in IB itself. Click your way down to the table column (click to select the scroll view, click again to select the table, click once more to select the column). Then click *again* on the cell at the top of the column to select it, then go to the Attributes tab of IB's inspector window. There's a popup menu there that allows you to go to any segment, and a text field you can use to enter its label. (Similarly, on the Size tab, there's a popup menu for choosing which segment you want to set the size for.)

There appear to be no bindings for the segment labels. I would take that as a hint that the segment labels are intended (as a UI matter) to remain the same, and not vary from row to row. (However, if you needed to do that, I guess you could use a table view delegate to change the NSSegmentCell before it draws.)

Note that, say, check box cells work analogously. They have a binding (called "Value") which determines whether they are on or off. However the text that appears beside the checkbox is entered in IB and has no available binding.

HTH

_______________________________________________

Cocoa-dev mailing list ([email protected])

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]

Reply via email to