Re: Binding to NSButtonCell in NSTableView [SOLVED]
Re: Binding to NSButtonCell in NSTableView [SOLVED]
- Subject: Re: Binding to NSButtonCell in NSTableView [SOLVED]
- From: Knud Möller <email@hidden>
- Date: Tue, 11 Apr 2006 12:01:11 +0100
Oh no.
Stupidity has prevented me from realizing that it is indeed possible
to change the type of data cell in an NSTableView in IB directly.
Just for the record: in IB, drag any desired cell type (e.g. a check-
box) from the "Cocoa Data" palette onto the table column. It's that
easy. Works perfectly... :-P
Thanks everyone who pointed this out to me.
Cheers,
Knud
Am 11.04.2006 um 10:36 schrieb Jonathan Fewtrell:
Knud
If you assign the button to the column in IB it works fine for me.
In your case is it necessary to do it programatically?
Regards
Jon
Message: 2
Date: Mon, 10 Apr 2006 16:25:06 +0100
From: Knud M?ller <email@hidden>
Subject: Binding to NSButtonCell in NSTableView
To: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset=ISO-8859-1; delsp=yes;
format=flowed
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