Hightlight on mouseover a NSTextFieldCell inside a TableView
Hightlight on mouseover a NSTextFieldCell inside a TableView
- Subject: Hightlight on mouseover a NSTextFieldCell inside a TableView
- From: Gustavo Pizano <email@hidden>
- Date: Tue, 1 Dec 2009 11:06:53 +0100
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?
Thanks
Gustavo
_______________________________________________
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