Can I get slider's value in "On Update" script?

Roman Grebenyuk shared this question 2 years ago
Answered

Hello.

I create a Slider. Its name is "a".

I create a script in "On Update" for this Slider.

Can I get the value of this slider after changing for using in the script?

Comments (5)

photo
1

The name a is also used for its value, so a gives you the value and you can use it anywhere to refer to the value of the slider.

chris

photo
1

Thank you.

But:

1. If I wrote - "SetValue(a, Cell(2,4))" I get from a spreadsheet value of Cell. All is OK.

2. But If I wrote - "SetValue(a, Cell(n,4))" where "n" - is name of the same Slider, "a" change status on "undefined".

Can I use name of a Slider as a row number in Cell?

photo
1

Chris, Thank you.

I find my mistake. I change row and coloumn in my script.

photo
photo
1

Can I get the value of this slider after changing for using in the script?

Yes, %0 gets replaced with the object's name eg

SetValue(%0,1)

photo
1

el supuesto script funciona perfectamente pero es de un comportamiento totalmente impredecible pues no sabemos en qué punto va a terminar el deslizador


intenta predecir qué valor va a tomar el deslizador cuando yo lo mueva con el raton


si lo uso escribiendo por ejemplo setvalue(n,5) en la linea de entrada el deslizador se mueve a 2 como era de esperar

hay que conocer que setvalue() dentro de un script no se considera un update del valor del objeto para no tener scripts en bucle infinito

Files: foro.ggb
© 2023 International GeoGebra Institute