• 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: Newbie: Easy "mouseEntered" Question...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie: Easy "mouseEntered" Question...


  • Subject: Re: Newbie: Easy "mouseEntered" Question...
  • From: Pandaa <email@hidden>
  • Date: Mon, 3 May 2004 02:11:12 +0200

Hi!
Easy "mouseEntered" Question: I have a well working
tableView which dataSource is an NSDocument Object.
In this object in the windowControllerDidLoadNib I
have put respectively (to try):
[[aController window] setAcceptsMouseMovedEvents:YES];
OR
[[tableView window] setAcceptsMouseMovedEvents:YES];

Mouse moved and mouse entered/exited are two very different things in cocoa. To receive mouse entered/exited messages for tracking rects, you do not need to nor should you setAcceptsMouseMovedEvents.

In both cases when I move the mouse in the tracking
rects created with:

rectObject = [tableView
frameOfCellAtColumn:columnCount row:rowCount];
[tableView addTrackingRect:rectObject owner:tableView
userData:NULL assumeInside:NO]);

( curious name there, NSRect is not a class but a C struct )

You are adding tableView as the owner of the tracking rect, that means that tableView will get sent mouseEntered and mouseExited messages for the tracking rectangle.

Also, remember that the rectangle should be in the bounds coordinate system of the receiver view.

added to a mutableArray and then released.

AND I override
- (BOOL)acceptsFirstResponder {
NSLog(@"accepting");
return YES;
}
AND I override both
- (BOOL)resignFirstResponder;
- (BOOL)becomeFirstResponder;

Irrelevant for tracking rectangles.

AND I add
- (void)mouseEntered: (NSEvent *)event {
NSLog(@"mouseMoved");
}

If you add this to the class of your tableView above you should get the print outs as expected.

in my NSDocument class, the dataSource of the
tableView, the only evident reaction I get, is that
the tableView from "main window" get dimmed as a
background window. And that's it.

What did you expect the tableView to do when it receives mouseEntered for your tracking rect that it is not internally aware of? ( unless you're subclassing it, of course, but it doesn't seem like that from your message )

I know about the Responder Chain and I remember the
old rocky eventLoop's switch(event){case mouseMoved:
....}.
Where and how can I get and use the Event Message?

In the object registered as the owner of the tracking rectangle. That object will get sent mouseEntered and mouseExited events for the tracking rectangle. It will not get sent mouseMoved messages, that is something else.

If you want to track mouseMoved events, it will get much more complicated as Cocoa wasn't built with that in mind for other than views that is currently first responder. If someone has an elegant solution to this with no polling or tracking rectangle abuse please enlighten.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . earth water fire air software - the five elements . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. email@hidden . . www.synapticpulse.net .
_______________________________________________
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: Newbie: Easy "mouseEntered" Question...
      • From: mirco scanarini <email@hidden>
  • Prev by Date: ANN: OCSmart Hacks beta 2
  • Next by Date: Re: Message Notify
  • Previous by thread: ANN: OCSmart Hacks beta 2
  • Next by thread: Re: Newbie: Easy "mouseEntered" Question...
  • Index(es):
    • Date
    • Thread