get object type

lama0901 shared this question 6 years ago
Answered

Hi,


I wanted to print the type of a object to text on clicking a button.

So I used this javascript:


    var typeofobject = ggbApplet.getObjectType('A');

    ggbApplet.evalCommand('Typ="Text = "' + typeofobject);


A is currently a point.


I tried with:


    var typeofobject = ggbApplet.exists('A');

    ggbApplet.evalCommand('Typ="Text = "' + typeofobject);


Then it prints: "Text = true"


So why does it not print me the type?!


Thank you!


Best regards

Martin

Comments (4)

photo
1

Did you mean this?

    ggbApplet.exists('A')

photo
1

Did you mean this?

    ggbApplet.exists('A')


No,


So

    getObjectType('A')

should return a value like: "point" as string?

Isn that correct?


How to get the object type?


For example: I have an ellipsis, parabola, hyperbola (conic section).

I wanna print the actual type.


Thank you!

photo
1

Hi, try something like that :

    var typeofobject = ggbApplet.getObjectType('A');

    ggbApplet.evalCommand('type="'+typeofobject+'"');

photo
1

Hi, try something like that :

    var typeofobject = ggbApplet.getObjectType('A');

    ggbApplet.evalCommand('type="'+typeofobject+'"');


you made my day. great!!!


nah man. I don't understand the difference to mine, but thank you a lot!

© 2022 International GeoGebra Institute