Confused Development

I develop software and I often get confused in the process. I usually find the answers after a while, but a month later I can't remember them. So from now on, I will write them down here.

Tuesday, April 11, 2006

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:

At 10:56 pm, Anonymous Anonymous said...

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.

 
At 11:43 pm, Blogger Knud Möller said...

Hehe, that's exactly how I felt when I discovered how it works. :-O

 
At 6:30 pm, Blogger Korion said...

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!!!

 
At 6:31 pm, Blogger Korion said...

Thanks! Be sure to drag an NSPopupButtonCell, and not an NSPopupButton.

 

Post a Comment

<< Home