Need guidance in table sorting
Need guidance in table sorting
- Subject: Need guidance in table sorting
- From: Michael Tsai <email@hidden>
- Date: Mon, 10 Mar 2003 00:49:54 -0500
On Sunday, March 9, 2003 11:55:00 PM Yuhui <email@hidden> wrote:
>
I have a table in my application which I want to sort by column. I've
>
already designed the behind-the-scenes stuff, e.g. sorting methods,
>
but I'm stuck with the user-interface part and could use some
>
assistance.
>
>
1. It seems that for each table column header, I have to use its
>
setAction: method (from the NSActionCell parent) to attach the sort
>
method to it at startup. Is this correct?
Sounds like it would work, but I haven't tried it. It's probably easier
to use the table's -tableView:didClickTableColumn: delegate message.
>
2. How do I put a little triangle indicator image in the header, like
>
those seen in Apple's apps (e.g. Mail, iTunes)? I know how to use
>
setIndicatorImage:inTableColumn, but where do I find the triangle
>
image itself? I searched the mailing list archives in Mamasam and
>
found that there used to be a method, [NSTableView
>
_defaultTableHeaderSortImage], to get the prebuilt image, but when I
>
tried it, PB said that there was no such method, so it seems that
>
this undocumented feature doesn't work any more.
PB says there's no such method because there's no such public method (in
the headers). You can still send the message. To avoid the warning, you
could use -performSelector:. (Always test first that the object responds
to the selector.)
>
Is there an alternative?
On 10.2 you can get the images via:
[NSImage imageNamed:NSAscendingSortIndicator]
and
[NSImage imageNamed:NSDescendingSortIndicator]
This is documented in the AppKit release notes.
--
Michael Tsai <
http://www.c-command.com>
_______________________________________________
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.