Button for slider

Hum Nath Baral shared this question 9 months ago
Answered

Hello, How to construct a single button for slider which would activate animation and also stop it ? Thank you.

Comments (4)

photo
1

see attached

photo
1

Thank you very much. Instruction is sincerely appreciated.

photo
1

Create a boolean a=false

Create a slider b

Create a button. In the OnClick tab of the Properties window of the button, type the following commands:

SetValue(a,!a)
StartAnimation(b,a)
Basically the boolean value sets the animation status of the slider. When a is true, the animation starts, when a is false, the animation stops.

The command SetValue(a,!a) toggles the value of the boolean a any time you push the button.

I suggest using SetValue(a,!a) instead of the assignment a=!a that you can see in user alfabeta's file, because SetValue is more efficient.

See https://wiki.geogebra.org/e...

and https://wiki.geogebra.org/e...

photo
1

Thank you very much. We are really beholden for suggestion.

photo
© 2019 International GeoGebra Institute