Can I Set Caption of added point with Point Tool using GlobalJavaScript?
Answered
Hi everyone,
I am trying to make an applet using global Javascript that:
- Adds a point to a predefined list using the Tool Point. (solved).
- Change the caption of every added point. That is, instead of having the standard notation A, B,C, etc, to set the caption of each adde point as A1, A2, A3,... (not sure how to do it).
This is what I have done so far:
function ggbOnInit() { ev("Sx = {}"); ev("ind = 0"); ev("text1 = UnicodeToLetter(65)"); ev("text2 = Text(ind)"); ev("text3 = text1 + text2"); ggbApplet.registerAddListener("listener"); } function listener(obj) { if (ggbApplet.getObjectType(obj) == "point") { ev("SetValue(Sx, Length(Sx) + 1, " + obj + ")"); ev("SetValue(ind, ind + 1)"); ev("SetCaption(" + obj + ", text3)"); } } function ev(x) { ggbApplet.evalCommand(x); }I could not find something related in the forum. Is this possible? Any help would be appreciated.
Thank you.
1) Have you tried simply renaming them?
2) Please always post your .ggb file
Sorry, here is the file.
I thought that to rename the object I need to use the command SetCaption(). Is there a "rename" command?
https://wiki.geogebra.org/e...
Comments have been locked on this page!