Reading value of a checkbox in an NSTable
Reading value of a checkbox in an NSTable
- Subject: Reading value of a checkbox in an NSTable
- From: "Mike O'Connor" <email@hidden>
- Date: Tue, 22 Jun 2004 14:49:41 -0400
I've got an NSTable with a few columns, and in one column I've placed
an NSButtonCell there with IB. This cell is set to be a checkbox. When
the user clicks a checkbox, I want to call an IBAction so I can read
the new state and set some data appropriately.
I have set in IB the target of the NSButtonCell to my action. When the
user click a checkbox, the action does get called, but the sender is
not the Cell, but rather the NSTableView. Why?
Since I only have the whole table, I have to find the cell that was
clicked, so I use code like this:
unsigned theRow= [sender selectedRow];
NSTableColumn* theColumn= [sender tablecolumnWithIdentifier:myColumnID];
NSButtonCell* theCell= [theColumn dataCellForRow:theRow];
That all seems to work, but when I ask for [theCell state] or [theCell
intValue] I always get 1. Why?
Thanks in advance! -Mike
_______________________________________________
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.