Set and show NSSlider position using code (not with mouse)
Set and show NSSlider position using code (not with mouse)
- Subject: Set and show NSSlider position using code (not with mouse)
- From: Jeff Skrysak <email@hidden>
- Date: Wed, 16 Jul 2003 20:15:00 -0500
I've got an application with an NSSlider, and it works okay. The user
can set
it, move it, etc...
Let's say that the slider has a minimum of 0.0 and a maximum of 1.0 and
the default starting point is 1.0
Now, the functionality I am working on adding is the ability to save
the slider's value
as a preference (easily done) and then when they open the program back
up again,
the slider starts at the value they last chose (the hard part).
I'm having trouble with that last part. Here's my code:
[speedSlider setFloatValue: [defaults floatForKey:@"Speed"]];
[speedSlider setNeedsDisplay:YES];
But it doesn't work. The slider just starts out at 1.0, not 0.5 or any
other value that
is stored in the user defaults. I get the value from the user defaults,
and then
try to set the slider's value equal to it. I then say it needs to be
displayed, all in the hopes
that the slider will change position. No dice.
How do I make the slider move, using code?
How do I set it's current position, and make it show that in the GUI?
Thanks for any help.
- Jeff
_______________________________________________
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.