• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How to set checkbox state in TableView columnheader
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to set checkbox state in TableView columnheader


  • Subject: How to set checkbox state in TableView columnheader
  • From: "Zhang Li" <email@hidden>
  • Date: Thu, 8 Oct 2009 16:23:46 +0800

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 to change its value to on/off.



My code snippet is as below:



// Create CheckBox on Column Header
 NSButtonCell *cell = [[ NSButtonCell alloc] init];
 [cell setTitle:@"Checkbox"];
 [cell setButtonType:NSSwitchButton];
 [cell setBordered:YES];
 [cell setImagePosition:NSImageLeft];
 [aColumn setHeaderCell:cell];

 [cell release];



By default checkbox is off state. 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.



Any help be deeply appreciated.



Echo
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: How to set checkbox state in TableView columnheader
      • From: Corbin Dunn <email@hidden>
    • Re: How to set checkbox state in TableView columnheader
      • From: Jerry Krinock <email@hidden>
  • Prev by Date: Re: Hide an Item on Desktop
  • Next by Date: Automatic language detection - a bug (again) or what. Snow Foundation NSSpellServer.
  • Previous by thread: Re: Hide an Item on Desktop
  • Next by thread: Re: How to set checkbox state in TableView columnheader
  • Index(es):
    • Date
    • Thread