Selecting Scripts

HenriAugusto shared this idea 7 years ago
Answered

Hi!


I think it would be great if we had GGBscripts and/or javascript methods to


  • -Select/unselect specific objects

    -get the state of current selected object


Thanks for your attention,

Henri.

Comments (5)

photo
1

Hi!

I think it would be great if we had GGBscripts and/or javascript methods to

  • -Select/unselect specific objects

    -get the state of current selected object

Thanks for your attention,

Henri.

test the attached file

enrico

https://ggbm.at/850781

photo
1

Hi!

I think it would be great if we had GGBscripts and/or javascript methods to

  • -Select/unselect specific objects

    -get the state of current selected object

Thanks for your attention,

Henri.

test the attached file

enrico

Test the file again entered

prova il file allegato nuovamente inserito

e

https://ggbm.at/850783

photo
2

This wiki page contains a useful list of Javascript methods.

Please check and ask again with a more detailed example if you need more help.

photo
1

Hi!

I think it would be great if we had GGBscripts and/or javascript methods to

-Select/unselect specific objects

-get the state of current selected object

[/li][/ul]


Please check and ask again with a more detailed example if you need more help.

on hold see this attached file that works:

https://ggbm.at/850789

photo
1

I'm sorry, but i think i mentioned a script about "selecting/unselecting objects". But that's already existent in Geogebra. It was very late at night when i posted and the coffee was wering off haha (a proof that i already knew that is that i mention it in this earlier post :p). Anyway, thanks a lot for taking your time, it really means something :)


What i really meant is a GGB script / javascript method to getting the state of the selected object. Something like


ggbApplet.getValue(ggbApplet.selectedObject);


or


ggbApplet.getValueSelected("name");


I searched through the forum and all the references, (including JS reference, of course) but didn't found anything. I believe it is impossible in the current state of things to get, for example, the object name or value of the selected Point.


My argument: In GGB .xml files there is no reference of what object is selected, so this information must be internal to GGB software itself, not it's constructions.


I'm aware of a way of "faking" getting the selected objects states with:

ggbApplet.registerClickListener("Select");


function Select(name){

ggbApplet.evalCommand("LastSelObj=\""+name+"\"") /* saves the last selected object, so you can use getValueString("LastSelObj")*/

}

but this way it doesn't works when selecting objects through the Algebra Window. Also, the current selected object may have been selected through a SelectObjects[] script.


That explains my request.


Btw, when will the new commands be added to the main JS reference page?


  • -registerObjectClickListener(String objName, String JSFunctionName);

    -unregisterObjectClickListener(String objName);

    -registerClickListener(String JSFunctionName);

    -unregisterClickListener(String JSFunctionName);


Thanks a lot for you help!

Best regards,

Henri.

© 2022 International GeoGebra Institute