Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Binding to NSButtonCell in NSTableView



Hi,

I have seen this question pop at least twice in the archives, but always without an answer:

I want to bind a table column to a BOOL field ("active") of an array objects. That works fine: I set up the bindings in IB, and without any further modifications, TRUE gets displayed as "1" and FALSE as "0". Then I programatically change the table column' s data cell to an NSButtonCell, type NSSwitchButton, using the code below:

	// set the "active" column cell to be an NSButtonCell:
	NSButtonCell *activeCell = [[NSButtonCell alloc] init];
	[activeCell setButtonType: NSSwitchButton];
	[activeCell setTitle: @""];
	[activeCell setEnabled: YES];
	[activeColumn setDataCell: [activeCell autorelease]];

That works fine to a degree. The BOOLs now get rendered correctly as checkboxes (either on or off). However, I cannot manipulate the checkboxes; clicking them has no effect. If I double-click, I suddenly get a text field editor. Does changing the column's data cell break the binding? I thought so and tried to do a programatic binding:

	[activeCell bind: @"value"
			toObject: activePluginsArrayController
		 withKeyPath: @"selection.active"
			 options: nil];

However, no result. Which steps am I missing here? Any help appreciated.

Cheers,
Knud
-------------------------------------------------
Knud Möller, MA
+353 - 91 - 495086
Digital Enterprise Research Institute
  National University of Ireland, Galway
Institiúid Taighde na Fiontraíochta Digití
  Ollscoil na hÉireann, Gaillimh


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.