Re: How do I track the mouse movement in a NSTableView cells?
Re: How do I track the mouse movement in a NSTableView cells?
- Subject: Re: How do I track the mouse movement in a NSTableView cells?
- From: Ricky Sharp <email@hidden>
- Date: Wed, 29 Dec 2004 11:21:20 -0600
On Wednesday, December 29, 2004, at 10:59AM, Christoph Priebe <email@hidden> wrote:
>I would like to track the mouse movement in a NSTableView cell to change
>the appearance of the cell while the mouse is over it. I looked at the
>API docu
>for NSCell and NSTableView etc. but I can't see an obvious solution.
>Where do I need to handle this? In the cell or in the NSTableView?
Only NSViews can have tracking rectangles (actually, the tracking rects are ultimately managed by a window).
>Do I need to change my NSTableView subclass to register a mouse track
>rectangle
>for every (visible) cell in the table? Or is there an other way? Is
>there any
>sample code regarding this topic?
Don't know of any sample code, but what I'd start out with is a having a subclass of NSTableView that would listen to mouse-moved events. It should then be fairly straightforward to obtain the cell that the cursor is over, set some attribute of the cell based on position of the cursor within it, then redisplay the cell. You'll then need to have your NSTableView subclass remember the current cell the mouse is over so you can redisplay it in its original form when the mouse moves off of it.
There are more edge cases to solve as well. For example, the mouse stays in the same position, but your table view is scrolled (e.g. with the Page Down key).
--
Rick Sharp
Instant Interactive(tm)
_______________________________________________
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