• 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
Binding to NSButtonCell in NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Binding to NSButtonCell in NSTableView


  • Subject: Binding to NSButtonCell in NSTableView
  • From: Knud Möller <email@hidden>
  • Date: Mon, 10 Apr 2006 16:25:06 +0100

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: This email sent to email@hidden
  • Prev by Date: Beginner with Objective-C was Re: scanf...?
  • Next by Date: Re: Beginner with Objective-C was Re: scanf...?
  • Previous by thread: Re: Beginner with Objective-C was Re: scanf...?
  • Next by thread: Help with undo/redo and NSArrayController
  • Index(es):
    • Date
    • Thread