• 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
Re: Properly handling mouseEntered: events
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Properly handling mouseEntered: events


  • Subject: Re: Properly handling mouseEntered: events
  • From: Henry McGilton <email@hidden>
  • Date: Wed, 25 Jun 2003 08:35:35 -0700

On Wednesday, June 25, 2003, at 05:17 AM, Stiphane Sudre wrote:

On mercredi, juin 25, 2003, at 14:00 Europe/Paris, Aidas Dailide wrote:

Hi there,

I read Apple's documentation on how to handle mouseEntered event. I have subclass of NSView and i've overridden mouseEntered in it, but no luck. I even tried setAcceptsMouseMovedEvents setIgnoresMouseEvents:NO] ( I sent them to [myview window]), but still no luck.

I also tried to add tracking rectangle, but nothing! What could be wrong? I am sure that my NSView subclass accepts first responder.

You indeed need to add a tracking rectangle. Can you show us the code you're using?


I discovered the hard way that you have to add the tracking rectangle(s)
in the code that creates the view --- that is, outside of the view's
code.

So you would do something like (from real code):

guidemover = [GuideHorizontalMover alloc];
guidemover = [guidemover initWithFrame: guidemoverrectangle];
[guidewindowbackdrop addSubview: guidemover];
guidemovertrackingtag = [guidemover addTrackingRect:
NSMakeRect(0, 0, GUIDELINES_MOVER_WIDTH, GUIDELINES_MOVER_HEIGHT)
owner: guidemover userData: nil assumeInside: NO];

So I have alloc'd, init'd, and place the view into its superview
prior to adding the tracking rectangle.

I had previously thought to add the tracking rectangle in the
initWithFrame method of the view that was being created, but
discovered that that did not work.

Additionally, make sure you keep the tracking rectangle tag
around, because if you move the view within its superview, you
must remove the tracking rectangle and re-instate it.

The obtuse behaviour of tracking rectangles stems from the fat
that the window containing the view(s) maintains the tracking
rectangles.

This is all I know about tracking rectangles, and my advice here
is based on blundering about (not programming at all) until I
blundered into something that worked. Like mixing martinis, I
am sure that somebody will immediately spring out from behind a
mangrove tree to tell me I am wrong.

Best Wishes,
........ Henry


===============================+============================
Henry McGilton, Boulevardier | Trilithon Software
Objective-C/Java Composer | Seroia Research
-------------------------------+----------------------------
mailto:email@hidden | http://www.trilithon.com
|
===============================+============================
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Properly handling mouseEntered: events
      • From: Greg Titus <email@hidden>
References: 
 >Re: Properly handling mouseEntered: events (From: Stéphane Sudre <email@hidden>)

  • Prev by Date: Re: meaning of if (self = [super init])
  • Next by Date: Hack TV
  • Previous by thread: Re: Properly handling mouseEntered: events
  • Next by thread: Re: Properly handling mouseEntered: events
  • Index(es):
    • Date
    • Thread