Changing Data Cells in NSTableView
I guess I shouldn't be afraid of posting even the stupidest things here (or most stupid, check this poll).
I recently tried to change the data cell type in an NSTableView (in the column, to be more precise) from the default text field to a check-box, so that I could bind it to a BOOL variable. I didn't see straight away how to do this in Interface Builder, and so started to try doing it programmatically. All kinds of funky problems ensued (read about it here), but the short version is: I couldn't get it to work.
Only when I was informed that you indeed can change the data cell in IB, I figured out how to do it - and guess what, it's amazingly simple, and it works straight away. Just drag any desired cell type (e.g. a check-box) from the "Cocoa Data" palette onto the table column. It's that easy. :-P
4 Comments:
Holy crap. I've been looking all over for this. Thanks for this page... I guess it should be obvious, but it wasn't at all obvious to me.
Hehe, that's exactly how I felt when I discovered how it works. :-O
I read this and was so pissed : whenever I dragged an NSPopupButton into a column, the other columns didn't set their data right anymore. I solved it by dragging an NSPopupButtonCell instead. Thanks, Knud!!!
Thanks! Be sure to drag an NSPopupButtonCell, and not an NSPopupButton.
Post a Comment
<< Home