[Newbie question] Subclassing NSButton
[Newbie question] Subclassing NSButton
- Subject: [Newbie question] Subclassing NSButton
- From: "JECKER Frédéric" <email@hidden>
- Date: Sun, 6 Aug 2006 20:52:11 +0200
Hi all,
I create a simple window with one button and one NSTextField
The idea is to display contextual text when the button is hovered by the mouse.
To do this I subclassed the NSButton class and created the
HoverNSButton class (code attached) which uses the following code to
catch the mouse events :
- (void)viewDidMoveToWindow{
[self addTrackingRect:[self visibleRect] owner:self userData:nil
assumeInside:NO];
}
- (void) mouseEntered:(NSEvent *)theEvent{
NSLog(@"Mouse Entered");
}
- (void) mouseExited:(NSEvent *)theEvent{
NSLog(@"Mouse Exited");
}
This works well, but I tried to turn this a little more dynamic by
adding the following method to my HoverNSButton class:
- (void) setContext:(NSString*)content container:(NSTextField*)field{
NSLog(@"Setting Context");
NSLog(content);
text=content;
NSLog(text);
textfield=field;
}
The goal of this method is to be called by the window controller to
set the text for each HoverNSButton.
I call this method for each button in my controller but this don't work.
I tried to debug the whole thing but the debugger doesn't enter the
setContext method.
Any ideas???
Thanks a lot
_______________________________________________
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