• 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
deselecting a column header for NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

deselecting a column header for NSTableView


  • Subject: deselecting a column header for NSTableView
  • From: Chuck Soper <email@hidden>
  • Date: Fri, 22 Aug 2003 14:05:18 -0700

I am about to implement sorting rows in my NSTableView object in response to the user clicking on a column header. One way I discovered to do this is to respond to the shouldSelectTableColumn NSTableView delegate as shown in the code at the end of this message.

But, I need a way to unhighlight all column headers because I want to sort by something that is not in a column. (I'll have a Sort popup menu to do this.) I've discovered that after sending setHighlightedTableColumn:tableColumn to the table view that the NSCell's state and selection do not change:
int state = [[[tableView highlightedTableColumn] headerCell] state];
BOOL isHighlighted = [[[tableView highlightedTableColumn] headerCell] isHighlighted];

It seems like that there is an assumption that once you send setHighlightedTableColumn:tableColumn you'll never need to unhighlight all column headers (this is how the finder works).

I have discovered that I can unhighlight all column headers with the following line:
[tableView setHighlightedTableColumn:nil];
Is the correct way to unhighlight all column headers?
Thanks, Chuck

//NSTableView delegate
- (BOOL)tableView: (NSTableView *)tableView
shouldSelectTableColumn: (NSTableColumn *)tableColumn
{
[tableView setHighlightedTableColumn:tableColumn];

//send setIndicatorImage to set the sort indicator image
// (use NSAscendingSortIndicator or NSDescendingSortIndicator)

//send a message to sort the rows in my table

return NO; //don't select the column
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: NSMenu as a submenu of more than one NSMenu
  • Next by Date: Splash panels, was "Centering a window"
  • Previous by thread: NSMenu as a submenu of more than one NSMenu
  • Next by thread: Splash panels, was "Centering a window"
  • Index(es):
    • Date
    • Thread