FROM : JECKER Frédéric
DATE : Sun Aug 06 20:52:11 2006
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
DATE : Sun Aug 06 20:52:11 2006
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
| Related mails | Author | Date |
|---|---|---|
| JECKER Frédéric | Aug 6, 20:52 | |
| Tommy Nordgren | Aug 6, 21:24 | |
| Matt Neuburg | Aug 7, 00:23 | |
| JECKER Frédéric | Aug 7, 08:17 | |
| Matt Neuburg | Aug 7, 17:39 |






Cocoa mail archive

