• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
[Newbie question] Subclassing NSButton
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[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


  • Follow-Ups:
    • Re: [Newbie question] Subclassing NSButton
      • From: Tommy Nordgren <email@hidden>
  • Prev by Date: Re: Re: FSCopyObjectASync callback handler
  • Next by Date: Re: [Newbie question] Subclassing NSButton
  • Previous by thread: Re: fade desktop like dashboard
  • Next by thread: Re: [Newbie question] Subclassing NSButton
  • Index(es):
    • Date
    • Thread