Re: Need help moving an NSSlider
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.