• 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: Re: NSSlider did finish sliding
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re: NSSlider did finish sliding


  • Subject: Re: Re: NSSlider did finish sliding
  • From: "Bruce Johnson" <email@hidden>
  • Date: Sat, 2 Sep 2006 10:14:32 -0700

Thanks, it was just what I needed.

Maybe you could give a small explanation as to the underlying machinery of:

[NSObject cancelPreviousPerformRequestsWithTarget: self selector: sel
object: sender];

I'm happy that it works, but what is it doing.

thanks

On 9/2/06, Michael Ash <email@hidden> wrote:
On 9/2/06, Bruce Johnson <email@hidden> wrote:
> I need an NSSlider to operate on two levels.
>
> 1- to continuously update while it is being dragged (via the checkbox in IB)
> 2- to inform (via delegate or notification) that the user has finished
> dragging the slider control (via mouseUp I'm guessing)
>
> I've tried something simple (and obvious) like subclassing NSSlider
> and over-riding the mouseDown and mouseUp methods of NSResponder. But
> maybe I don't know enough about overriding events to get it to work.
> I suspect something in the responder/event chain...
>
> int the subclass of the slider:
> - (void)mouseDown:(NSEvent *)theEvent
> {
>         NSLog("@mouse down");
>         [super mouseDown: theEvent];
> }
>
> - (void) mouseUp: (NSEvent *)theEvent
> {
>         NSLog("@mouse up");
>         [super mouseUp: theEvent];
> }
>
> I can't get the mouseUp log to print.  What other hoops am I missing?

There is no need to subclass NSSlider to get this functionality.
Merely make your action method look like this:

- (void)sliderMoved: (id)sender {
   SEL sel = @selector( sliderDone: );
   [NSObject cancelPreviousPerformRequestsWithTarget: self selector:
sel object: sender];
   [self performSelector: sel withObject: sender afterDelay: 0.0];
}

Because the runloop mode is different during event tracking, the
delayed perform doesn't happen until the mouse is released.

Mike
 _______________________________________________
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



--
----
Bruce Johnson
email@hidden
_______________________________________________
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


  • Follow-Ups:
    • Re: Re: Re: NSSlider did finish sliding
      • From: "Michael Ash" <email@hidden>
References: 
 >NSSlider did finish sliding (From: "Bruce Johnson" <email@hidden>)
 >Re: NSSlider did finish sliding (From: "Michael Ash" <email@hidden>)

  • Prev by Date: Re: Object Layering is Changing When Calling -addSubview:
  • Next by Date: CoreData and undo/redo
  • Previous by thread: Re: NSSlider did finish sliding
  • Next by thread: Re: Re: Re: NSSlider did finish sliding
  • Index(es):
    • Date
    • Thread