"Get caption" command

keyboarder shared this question 4 years ago
Answered

Is there a simple, direct way to get the caption on an object? Ideally, something like

    GetCaption[<object>]

A search of online help and forums reveals no such function.


To be precise, what is needed is a simple command that returns the raw caption text, the same text as if setting it in the Object properties (Basic tab) from the Geogebra GUI. I specifically mention the raw text value, because caption text can have placeholders (e.g. %n) and embedded LaTex (e.g. $ x^{2} $). I am not searching for a function that returns the formatted text. (Besides, a formatted caption--especially with embedded LaTex--would necessarily generate some type of image, of which I am not interested.)


(Note: A search of these forums reveals one answer in French which includes a custom xml-editing Java script that can do this, but I'm not interested in maintaining and debugging such a script... especially one that manually parses the XML with regular expressions.)

Comments (3)

photo
1

Hi


I don't think so...


But you can see all definitions in AlgebraView

Options > Algebra descriptions > Definition


or F3 > Copy definition in input bar


Perhaps that helps...

photo
1

I have the same question. I'd like to use GGB script to make the caption of a button change back and forth between "A" and "B" every time it is clicked. The OnClick script for the button would simply be

  1. If[GetCaption[btn] == "A", SetCaption[btn, "B"], SetCaption[btn, "A"]


but, alas, there is no GetCaption command.

photo
1

The problem of Marc can be solved without a command GetCaption. You can use an auxilliary variable toggling between e.g. 0 and 1. Then you can define the caption of a button, depending of the value of that variable.

This brings me back to the original question. You define the caption of a button. So haven't you got it then?

In the case of the added file something as textcaption=If[ var==0, "A", "B"]

Can you give an example in which case the caption is unknown?

chris

0d45db196089816aa2084839d7d4a78a

© 2019 International GeoGebra Institute