• 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
Re: How to set checkbox state in TableView columnheader
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to set checkbox state in TableView columnheader


  • Subject: Re: How to set checkbox state in TableView columnheader
  • From: Corbin Dunn <email@hidden>
  • Date: Fri, 09 Oct 2009 08:24:06 -0700

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 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];

What you are doing will not work.

/* Gets and sets the headerCell associated with this NSTableColumn. 'cell' must be non nil, and should be a member of the NSTableHeaderCell class. The 'headerCell' is a strong reference, and will be retained.
 */
- (void)setHeaderCell:(NSCell *)cell;
- (id)headerCell;

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).

--corbin


_______________________________________________

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: Jerry Krinock <email@hidden>
References: 
 >How to set checkbox state in TableView columnheader (From: "Zhang Li" <email@hidden>)

  • Prev by Date: Re: Updating application info plist
  • Next by Date: Re: Are these Apple or 3rd party classes?
  • Previous by thread: Re: How to set checkbox state in TableView columnheader
  • Next by thread: Re: How to set checkbox state in TableView columnheader
  • Index(es):
    • Date
    • Thread