Re: Hightlight on mouseover a NSTextFieldCell inside a TableView
Re: Hightlight on mouseover a NSTextFieldCell inside a TableView
- Subject: Re: Hightlight on mouseover a NSTextFieldCell inside a TableView
- From: Corbin Dunn <email@hidden>
- Date: Tue, 01 Dec 2009 10:42:07 -0800
On Dec 1, 2009, at 2:06 AM, Gustavo Pizano wrote:
> Hello, I have been searching how to achieve this.
> I have a NSTableView and the NSTableCells are a subclass I made.
> Now I want to change the backgorund color of the table row when mouse over. In my SubClass of NSTextFieldCell I tried overriding these methods
> - (BOOL)startTrackingAt:(NSPoint)startPoint inView:(NSView *)controlView{
> NSLog(@"tracking.. %@",[self stringValue]);
> return YES;
> }
>
>
> - (BOOL)trackMouse:(NSEvent *)theEvent inRect:(NSRect)cellFrame ofView:(NSView *)controlView untilMouseUp:(BOOL)untilMouseUp{
> NSLog(@"here");
> return YES;
> }
>
>
> off course I see nothing of the logs.. it was just a tryout. .. now i dunno how to make NSTextFieldCell respond to mouse events, i.e a mouse entered, this for NSResponder class and subclasses, so I was thinking in defining a NSTrackingArea, but because of NSTextField don't accept mouseEntered method then I dunno.
>
> I thought then maybe to subclass NSTableView, and do something with the point f the mouse, and then get the row at point, form the NSTableView, but this method returns me a integer, so then I will multiply by the row height and create a NSREct and draw a background in that rect, but I dunno if this is a good approach.
>
> Any ideas?
Look at the PhotoSearch example for how to do mouse over animations. You'll have to extend it to do something for a given row.
corbin
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden