• 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: Need help moving an NSSlider
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need help moving an NSSlider


  • Subject: Re: Need help moving an NSSlider
  • From: John Pannell <email@hidden>
  • Date: Sun, 8 Feb 2004 21:55:41 -0700

Hi Iain-

You might just be seeing the fact that the slider does not get redrawn to reflect its new value. I would modify your code to read:

(IBAction)setSlider:(id)sender
{
[window insertText:[NSString localizedStringWithFormat:@"\nSender Value:%d",[sender intValue]]];
[slider setIntValue:[sender intValue]];
[slider setNeedsDisplay];
}

The setNeedsDisplay message reminds the control or view to redraw...

Hope this helps!

John

On Feb 8, 2004, at 5:23 PM, Iain Wood wrote:

Hi,

I think I'm missing something obvious, but I cant get this to work. Perhaps someone can spot what I'm doing wrong..

I'm trying to set the value of a slider from an incoming midi signal, and generate midi by moving the same slider. The midi bit I can do, but getting the slider to reflect the incoming midi signal has got me stumped. Stripping everything else away I'm left with this code:

#import <Cocoa/Cocoa.h>
@interface Controller : NSObject
{
IBOutlet id slider;
IBOutlet id window;
}
- (IBAction)setSlider:(id)sender;
@end


@implementation Controller
- (IBAction)setSlider:(id)sender
{
[window insertText:[NSString localizedStringWithFormat:@"\nSender Value:%d",[sender intValue]]];
[slider setIntValue:[sender intValue]];
}
@end

I have slider connected to an NSSlider, and window connected to an NSTextField. A second slider is connected to the setSlider method, and when I move that slider, a series of values gets sent to the window NSTextField, but the NSSlider connected to slider doesn't move.

Tia

Iain
_______________________________________________
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.
_______________________________________________
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: 
 >Need help moving an NSSlider (From: Iain Wood <email@hidden>)

  • Prev by Date: Re: Document App or not?
  • Next by Date: Re: Need help moving an NSSlider
  • Previous by thread: Re: Need help moving an NSSlider
  • Next by thread: Re: Need help moving an NSSlider
  • Index(es):
    • Date
    • Thread