Disable absolute screen position of slider using script

Kajak shared this question 3 years ago
Needs Answer

Hi,


I want to create sliders and put them on specific points of the coordinate system, only using scripts. My problem is that the sliders are created with absolute screen position by default, which means that when using the SetCoords command the sliders do not go where I want. Is there a way to disable the absolute screen position without doing it manually?


Thanks!

Best Answer
photo

try to use the attachment.

Use the Java-Script in sldPosAbsNam as black-box

If the description in the attachment is too short or something works as not expected: ask

Note: the JS works only for sliders

Comments (8)

photo
1

I think its not possible in "normal" Scripts.

Only way is with JavaScript GGB-XML-Commands.

photo
1

Is it a specific command using JS? Maybe I can figure something out.

photo
1

Question:

do you know JS?

If yes: also in GGB?

photo
1

I know some programming, but not JS, no. I have managed to replicate setting the position of the sliders using a JS for loop and setCoords command, which unsuprisingly does the same thing as before. Give it a shot!

photo
photo
1

try to use the attachment.

Use the Java-Script in sldPosAbsNam as black-box

If the description in the attachment is too short or something works as not expected: ask

Note: the JS works only for sliders

photo
1

It works great, thank you!


I didn't know that changing to coordinate position changed the slider width from pixels to distance in the coordinate system, but that is a minor inconvenience.

You've been of great help, thanks again!

photo
photo
1

cuando creo un deslizador con el comando slider() y escribo setcoords() el deslizador se traslada perfectamente

uso la version 5

¿hay algo que me he perdido? ¿por qué me funciona de otra manera?

photo
1

Kajak probably wants to bind the slider to an object (maybe even dynamically to different objects). This would work, even without JS, but is also complex.

It would be best if the script command Speed() also had the parameter "absPosition".

photo
© 2023 International GeoGebra Institute