controlling "selection allowed" from script
Completed
Sometimes it would be useful for me to be able to change the "selection allowed" status of an object from script. It would give extra functionality to applets I am trying to create.
Would you please consider adding a "SetSelectionAllowed" command to the list of scripting commands?
Also, for a slider and for checkbox if "selection allowed" is deselected, then the state cannot be changed. On the other hand for input box and for drop-down menu I see no difference between "selection allowed" true or false. If the "SetSelectionAllowed" command is implemented, then it would also be helpful for me if the state of "selection allowed" would have an effect on these input methods (i.e. blocking the changes when "selection allowed" is false).
You can do that with the second parameter of setFixed(), try
hi
they don't have to change together. Fixing overrules 'selection allowed', so you can't change a fixed object, since you can't select it. If you unfix it, then 'selection allowed' is valid back again.
Michaels solution includes that you check 'selection allowed' but at the same time you decide by fixing or unfixing an object if this option is valid or not.
chris
Thank you again, but can you please take a look at the applet I attach? It does not work as intended, or I am not doing something right (I tried with the javascript code Michael suggested, but for some reason it does not work for me, so I also tried with the SetFixed geogebra script command).
In the left column all objects are selectable, I am changing the fixed/not fixed status.
I've got no experiece with using javascript, but using ggscript you're absolutely right that the overruling only works with points and texts. The file you included is very demonstrative. Maybe someone could take a look at the scripting possibilities when working with the other types of objects or with javascript
chris
The second parameter of JavaScript method setFixed does that. So if you want to disable "selection allowed" of a fixed object A, try
ggbApplet.setFixed("A",true,false);
if you want to do the same for an object that's not fixed, try
ggbApplet.setFixed("A",false,false);
At the moment there is no getFixed method so you need to keep track of what's fixed yourself.
Ich would do i in a different way. You can have the same object two times and if one point should not be moveable and fixed, the fixed version should be visible.
If the point should be able to be moved, you show the moveable point and make the fixed point invisible.
I think that is much easier that to use scripting!
Comments have been locked on this page!