toggle view between caption and name

Dr. Gerry Wojnar shared this question 5 months ago
Needs Answer

I want the user to usually see an object's caption, and to be able to also view the object's name, either by (a) hovering the mouse over the object or (b) clicking on the object. A script with SetLabelMode(object, 0) changes the caption displayed to the name upon clicking on the object, but I don't know how to write a script that would toggle back to display the caption upon clicking the object again. I want to do this for many objects.

IF there were a way to access the current numerical value of the object's display mode (0 Name; 1 Name+Value; 2 Value; 3 Caption; 4 Caption+value) then I would try a script with SetLabelMode(object, Mod(3 + GetLabelMode(object, 6))) but I know no command that does "GetLabelMode".


Comments (1)


My typos in original:

"4 Caption+value"--->"9 Caption+value"

"SetLabelMode(object, Mod(3 + GetLabelMode(object, 6)))" -->

"SetLabelMode(object, Mod(3 + GetLabelMode(object), 6))"

© 2021 International GeoGebra Institute