• 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: Notification for mouse-up on NSStepper
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Notification for mouse-up on NSStepper


  • Subject: Re: Notification for mouse-up on NSStepper
  • From: John Stiles <email@hidden>
  • Date: Fri, 07 Dec 2007 08:54:56 -0800

I ended up overriding -mouseDown: to call super's mouseDown and then did my update afterwards. And comments aplenty to explain the situation.
It relies on implementation details, but I think Glenn's code also relies on (different) implementation details, so if it's six of one and a half dozen of the other, I'll take the more direct approach. ;)



Alastair Houghton wrote:
On 7 Dec 2007, at 14:56, glenn andreas wrote:

You can do this:

- (void) mouseDown: (NSEvent *) event
{
    [super mouseDown: event];
    if ([[NSApp currentEvent] type] == NSLeftMouseUp) {
        [self doSomethingAfterTracking];
    }
}
- (void) mouseUp: (NSEvent *) event
{
    [self doSomethingAfterTracking];
}

So if the super's mouseDown does the tracking loop, the current event will be the mouse up (that stopped the tracking loop). If it doesn't, then mouseUp will be called like normal.

Hmmm. I hadn't thought of checking -currentEvent. If we assume that there are no guarantees from Apple, it's better than doing nothing, though I think it still isn't completely robust wrt changes in the superclass.


Kind regards,

Alastair.

--
http://alastairs-place.net


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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


References: 
 >Notification for mouse-up on NSStepper (From: John Stiles <email@hidden>)
 >Re: Notification for mouse-up on NSStepper (From: Alastair Houghton <email@hidden>)
 >Re: Notification for mouse-up on NSStepper (From: glenn andreas <email@hidden>)
 >Re: Notification for mouse-up on NSStepper (From: Alastair Houghton <email@hidden>)

  • Prev by Date: Best way to bind an Inspector to iVars/Properties?
  • Next by Date: Re: Imaginary File Path
  • Previous by thread: Re: Notification for mouse-up on NSStepper
  • Next by thread: Re: Notification for mouse-up on NSStepper
  • Index(es):
    • Date
    • Thread