• 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: Catching NSSlider -mouseUp: events (workaround)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Catching NSSlider -mouseUp: events (workaround)


  • Subject: Re: Catching NSSlider -mouseUp: events (workaround)
  • From: Uli Kusterer <email@hidden>
  • Date: Wed, 11 Apr 2007 11:56:07 +0200

Am 11.04.2007 um 05:05 schrieb Roland Torres:
- (void)mouseDown:(NSEvent *)event
{
    [super mouseDown:event];   // eats the mouse-up event
    NSEvent upEvent=[NSEvent mouseEventWithType:NSLeftMouseUp ...
    [NSApp sendEvent:upEvent]; // dispatch mouse-up event
}

- (void)mouseUp:(NSEvent *)event
{
    [super mouseUp:event];
    // your code goes here ...
}

It might be safer (as in, not confusing anything in the event system that might expect mouse events to be balanced), if you just directly called whatever method you want to trigger instead of synthesizing a mouse event. E.g.:


- (void)mouseDown:(NSEvent *)event
{
[super mouseDown:event]; // eats the mouse-up event
if( [[self target] respondsToSelector: mouseUpSelector] )
[[self target] performSelector: mouseUpSelector withObject: self];
}


where mouseUpSelector would be an instance variable of type SEL, not unlike the action in target/action.

Cheers,
-- M. Uli Kusterer
http://www.zathras.de



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Catching NSSlider -mouseUp: events (workaround)
      • From: Roland Torres <email@hidden>
References: 
 >Catching NSSlider -mouseUp: events (workaround) (From: Roland Torres <email@hidden>)

  • Prev by Date: Re: WM_KEYDOWN
  • Next by Date: Re: Tooltip font size again ...
  • Previous by thread: Catching NSSlider -mouseUp: events (workaround)
  • Next by thread: Re: Catching NSSlider -mouseUp: events (workaround)
  • Index(es):
    • Date
    • Thread