Graham, For the first action:
Declaration: // allows user to set the value of the friction coefficient IBOutlet NSSlider *_frictionSlider; // displays friction coefficient chosen by the user IBOutlet NSTextField *_frictionDisplay; // allows user to set the mass IBOutlet NSSlider *_massSlider; // displays the mass chosen by the user IBOutlet NSTextField *_massDisplay; // allows the user to set the amount of forces applied to the ball IBOutlet NSSlider *_forceAppliedSlider; // displays the amount of force the user wishes to apply IBOutlet NSTextField *_forceAppliedDisplay; } When the sliders are moved: -(IBAction)changeParameters:(id)sender { // user adjusts slider for mass if([sender tag] == RBS_MassSliderTag) { [_massDisplay setFloatValue:[_massSlider floatValue]]; NSLog(@"Mass in changeParameters: %f\n", [_massSlider floatValue]); } // user adjusts slider for friction else if([sender tag] == RBS_FrictionSliderTag) { [_frictionDisplay setFloatValue:[_frictionSlider floatValue]]; } // user adjusts slider for force applied else { [_forceAppliedDisplay setFloatValue:[_forceAppliedSlider floatValue]]; } } When the start button is pressed: // friction [_simulationView setFrictionCoefficient:[_frictionSlider floatValue]]; // mass NSLog(@"Mass in startSimulation: %f\n", [_massSlider floatValue]); [_simulationView setMass:[_massSlider floatValue]]; On Jun 1, 2014, at 8:37 PM, Graham Cox <graham....@bigpond.com<mailto:graham....@bigpond.com>> wrote: On 2 Jun 2014, at 10:28 am, Peters, Brandon <bap...@my.fsu.edu<mailto:bap...@my.fsu.edu>> wrote: have a slider used to adjust a value. When the slider is moved, an action is triggered to display the value in a panel. When a start button is pressed, another action is triggered, and within that action the value of the slider is ascertained. I have discovered than when calling the second action, the value of the slider is zero, unlike the value when called from the first action. Is this expected behavior? How can get the slider to retain its value from the first called action? Thanks. This isn't the expected behaviour; sliders and all controls have a value that they remember constantly. How are you referring to the slider in the second action? Using an outlet? Is it connected? Show your code - something else is wrong. --Graham _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com