Re: Get click on table column header
Re: Get click on table column header
- Subject: Re: Get click on table column header
- From: "Mike O'Connor" <email@hidden>
- Date: Wed, 09 Jul 2003 12:47:31 -0400
On Saturday, July 5, 2003, at 11:37 PM, Matt Gemmell wrote:
What is the best way to catch clicks in the table column header?
Your tableview's delegate is automatically sent
-tableView:mouseDownInHeaderOfTableColumn: whenever the user clicks on
a
column header.
Just implement that method in your tableview's delegate, and do the
appropriate sorting depending on what column's header was clicked (and
don't forget to make the table reload its data after sorting).
See the NSTableView documentation for more. This source code might also
be useful:
<http://www.gigliwood.com/tabletester/>
Thanks, that source also has good info on adding the
ascending/descending feature to the columns.
In my case I'm actually sorting an NSOutlineView. The outline's
delagate methods are being called, but when I add
tableView:mouseDownInHeaderOfTableColumn this item is not getting
called. I figure I'm not just specifying it right for my outline view.
What might be the matter? I merely added to the .m file:
-(void)tableView:(NSTableView*)tableView
mouseDownInHeaderOfTableColumn:(NSTableColumn *)tableColumn
{ NSLog{@clicked"); }
_______________________________________________
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.