Re: Out-of-order enter/exit events
Re: Out-of-order enter/exit events
- Subject: Re: Out-of-order enter/exit events
- From: Ricky Sharp <email@hidden>
- Date: Tue, 15 Feb 2005 10:06:32 -0600
On Tuesday, February 15, 2005, at 08:58AM, M. Uli Kusterer <email@hidden> wrote:
>At 7:58 Uhr -0600 15.02.2005, Ricky Sharp wrote:
>>If I move the cursor slowly, I get the proper sequence of events
>>when entering/exiting the views. But, if the cursor moves quickly,
>>the enter/exit events still fire, but can be out-of-order.
>
> I'd suggest you just keep a pointer to the view that last showed its
>help tag around (i.e. set that global to self on mouseEnter:). Only
>hide the help tag from mouseExited: if the view that got the
>mouseExited: is the same as the last one that showed it.
>
> That way, in the case where a "hide" arrives after another "show",
>it will just be ignored.
I just implemented this as per your (and Andreas') suggestion. Works like a charm.
Thanks!
For the sake of the archives, I modified my custom window like this:
@interface HelpTagWindow : NSWindow
{
@private
NSView* owningView;
}
+ (void)showHelpTag:(NSView*)aView;
+ (void)hideHelpTag:(NSView*)aView;
@end
The implementation of HelpTagWindow...
+ (HelpTagWindow*)sharedHelpTagWindow
{
static HelpTagWindow* theHelpTagWindow = nil;
if (theHelpTagWindow == nil)
{
theHelpTagWindow = [[HelpTagWindow alloc] initWith...
}
return theHelpTagWindow;
}
- (NSView*)owningView
{
return owningView;
}
- (void)setOwningView:(NSView*)aView
{
owningView = aView;
}
+ (void)showHelpTag:(NSView*)aView
{
HelpTagWindow* theHelpTagWindow = [HelpTagWindow sharedHelpTagWindow];
[theHelpTagWindow setOwningView:aView];
[theHelpTagWindow orderFront:self];
}
+ (void)hideHelpTag:(NSView*)aView
{
HelpTagWindow* theHelpTagWindow = [HelpTagWindow sharedHelpTagWindow];
if ([theHelpTagWindow owningView] == aView)
{
[theHelpTagWindow setOwningView:nil];
[theHelpTagWindow orderOut:self];
}
}
My view's mouseEntered: and mouseExited:
- (void)mouseEntered:(NSEvent*)anEvent
{
[HelpTagWindow showHelpTag:self];
}
- (void)mouseExited:(NSEvent*)anEvent
{
[HelpTagWindow hideHelpTag:self];
}
--
Rick Sharp
Instant Interactive(tm)
_______________________________________________
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