• 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: NSSlider preventing events firing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSSlider preventing events firing


  • Subject: Re: NSSlider preventing events firing
  • From: Cameron Hayne <email@hidden>
  • Date: Thu, 10 Oct 2002 11:23:37 -0400

On 10/10/02 9:57 am, "Alan leigh" <email@hidden> wrote:
> I have an openGL view which is
> being forced to refresh ever two seconds or so by an NSTimer, which
> also increments a count which enables animation. I have an NSSlider
> which rotates the GL view (as in oh so many example apps). The two
> independently work quite nicely, but the problem is that if someone
> clicks and holds down an NSSlider the timer seems to stop firing (i.e
> rotation is lovely and smooth, but animation stops. When the slider is
> released, animation seems to 'catch up'. I suspected this might be a
> 'need to multithread' issue, but I can't figure out what exactly I
> should thread :) Any suggestions would be lovely.

You probably need to tell it to look for Timer events when using the Slider
by separately adding the timer to the runloop with
NSEventTrackingRunLoopMode. Here's an excerpt from my test program
"ImageCalc" (source available at http://hayne.net/MacDev/ImageCalc):

// We schedule timers to fire every 'timeout' seconds
// at which time we will tell the view to update itself
timer = [[NSTimer scheduledTimerWithTimeInterval: timeout
target: self
selector:@selector(updateDataView:)
userInfo: nil
repeats: YES] retain];

// We need the following line so that the view updates continue
// when the user is dragging the slider
[[NSRunLoop currentRunLoop] addTimer:timer
forMode:NSEventTrackingRunLoopMode];


--
Cameron Hayne (email@hidden)
Hayne of Tintagel
_______________________________________________
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.

References: 
 >NSSlider preventing events firing (From: Alan leigh <email@hidden>)

  • Prev by Date: Re: New to Cocoa
  • Next by Date: Wrapping C
  • Previous by thread: NSSlider preventing events firing
  • Next by thread: Wrapping C
  • Index(es):
    • Date
    • Thread