FROM : Tommy Nordgren
DATE : Sun Aug 06 21:24:47 2006
On Aug 6, 2006, at 8:52 PM, JECKER Frédéric wrote:
> 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
NSButton or it's base classes don't call the method
setContext:container:
because it is not an override of a standard method.
If you wan't it to be called, you must call it yourself from an
appropriate
method that your class overrides.
------------------------------------------------------
"Home is not where you are born, but where your heart finds peace" -
Tommy Nordgren, "The dying old crone"
tommy.<email_removed>
DATE : Sun Aug 06 21:24:47 2006
On Aug 6, 2006, at 8:52 PM, JECKER Frédéric wrote:
> 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
NSButton or it's base classes don't call the method
setContext:container:
because it is not an override of a standard method.
If you wan't it to be called, you must call it yourself from an
appropriate
method that your class overrides.
------------------------------------------------------
"Home is not where you are born, but where your heart finds peace" -
Tommy Nordgren, "The dying old crone"
tommy.<email_removed>
| 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

