• 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: Get click on table column header
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.
  • Prev by Date: Re: How do I add a perl script to a project?
  • Next by Date: Re: Origin of scroll view
  • Previous by thread: Get click on table column header
  • Next by thread: Drawing Arcs
  • Index(es):
    • Date
    • Thread