Re: How to set checkbox state in TableView columnheader

2009-10-11 Thread Zhang Li
Finally I made it! Again thanks to Jerry Krinock & Corbin Dunn. I've troubled by this issue for quite some days, and you saved me! =) I'm not sure whether it's the most proper way to do it, but the code works, I can change title, change background color and change checkbox state by clicking it

Re: How to set checkbox state in TableView columnheader

2009-10-10 Thread Zhang Li
Thank you so much for you guys' help. Jerry's sample code is extremely helpful for a newbie like me. =) I'll try this out once I'm back to my office. And let you know the outcome once I get it.. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com

Re: How to set checkbox state in TableView columnheader

2009-10-09 Thread Jerry Krinock
On 2009 Oct 09, at 08:24, Corbin Dunn wrote: What you are doing will not work. You have to create an NSTableHeaderCell subclass. Even then, you may have to subclass NSTableHeaderView to get it to work like a button with a button in it (header's are essentially buttons). Yes, I found that

Re: How to set checkbox state in TableView columnheader

2009-10-09 Thread Corbin Dunn
On Oct 8, 2009, at 1:23 AM, Zhang Li wrote: > Hi All, > > > > I want to place a checkbox on each NSTableView column header, when user click > on it, the checkbox can be set to checked/unchecked state accordingly. > > > > I successfully put checkbox on NSTableView column header by using fol

Re: How to set checkbox state in TableView columnheader

2009-10-09 Thread Jerry Krinock
Try to send your button cell a -drawWithFrame:inView: message after setting its state. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-ad

Re: How to set checkbox state in TableView columnheader

2009-10-09 Thread Zhang Li
Maybe you should update the NSTableView ? I did, but no luck. What's more, the creation of the checkbox and set its state to on are inside awakeFromNib, updating NSTableView looks like not necessary. BTW, when I click left mouse button on the checkbox, I can see tick appear inside the che

Re: How to set checkbox state in TableView columnheader

2009-10-09 Thread Zhang Li
NSButtonCell inherits from NSActionCell and NSCell. (See 2nd line of the NSButtonCell documentation). Click the links. Now, try -[NSCell setState:], which will probably work, and -[NSActionCell setObjectValue:], which might work. I called [cell setObjectValue:[NSNumber numberWithInt:1]] bef

Re: How to set checkbox state in TableView columnheader

2009-10-09 Thread Zhang Li
- Original Message - From: "Jerry Krinock" To: "Cocoa Developers" Sent: Friday, October 09, 2009 11:20 AM Subject: Re: How to set checkbox state in TableView columnheader Congratulations, it looks like you got the hard parts! NSButtonCell inherits from NSA

Re: How to set checkbox state in TableView columnheader

2009-10-08 Thread Jerry Krinock
Congratulations, it looks like you got the hard parts! On 2009 Oct 08, at 01:23, Zhang Li wrote: I tried to use [cell setIntValue:NSOnState] before [cell release] to set the checkbox to on state, but failed. Looks like [NSButtonCell SetIntValue] is not the right way to change checkbox state

How to set checkbox state in TableView columnheader

2009-10-08 Thread Zhang Li
Hi All, I want to place a checkbox on each NSTableView column header, when user click on it, the checkbox can be set to checked/unchecked state accordingly. I successfully put checkbox on NSTableView column header by using following code, I can see the checkbox there, but don't know how t