Re: highlightling custom table header cell on mouse clicks
Re: highlightling custom table header cell on mouse clicks
- Subject: Re: highlightling custom table header cell on mouse clicks
- From: Ken Victor <email@hidden>
- Date: Sun, 12 Feb 2006 14:17:59 -0800
to answer my own question, after much, MUCH experimentation, i've
discovered that rather than setting and checking whether or not the
cell is highlighted, i can check the cell's state. thus, i don't need
the table delegate method (tableView:mouseDownInHeaderOfTableColumn:)
ken
At 6:12 PM -0800 2/11/06, Ken Victor wrote:
like many before me, i wish to enable various text sizes, etc. in
the headers of my NSTableView. i have my subclass of
NSTableHeaderCell working in all but one case:
when the user clicks on a header cell, i have the table's delegate
method (tableView:mouseDownInHeaderOfTableColumn:) call
[[tableColumn headerCell] setCellAttribute: NSCellHighlighted to:
YES]. then in my override of drawWithFrame:inView: (in my subclass
of NSTableHeaderCell) i draw the cell appropriately based on whether
or not its highlighted, whether or not its the current sort column,
and whether or not its window is the key window. after drawing the
cell i set it to be not highlighted (ie, [self setCellAttribute:
NSCellHighlighted to: NO]).
the situation in which this fails is when the user clicks in the
header, moves the mouse vertically out of the header cell (and the
cell unhighlights) and then moves the mouse back into the header
cell (without letting up the mouse button). at this time the header
cell should again highlight. but of course, my table's delegate
method is not called again and thus the header cell doesn't
(re-)highlight. in looking at the stack trace (see below) for this
situation, i don't see how to easily hook into this situation, as
all i see on the stack are private methods. nor do i see a different
easy way to obtain this behavior. is it really necessary to provide
a subclass of NSTableHeaderView and do all mouse tracking myself to
really get the proper behavior? ie, i would have to detect clicks,
drag starts, etc.
from the archives (which have helped me to get this far) i see
several (lots of) people have desired to provide similar behavior.
has anyone solved this specific problem? and if so, can you tell me
how you did it?
thanx for any help/pointers/suggestions/etc.,
ken
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden