Attach Input Box to a Point?

StevePhelps shared this question 7 years ago

Is there a way to attache an INPUT BOX to a point, similar to attaching a text box to a point?

Thanks in advance!

Comments (2)


Hi, it's not so easy even if exists : because it uses absolute coordinates + in pixels. So you have to change the origin and the unity.

b: the InputBox

A : the free point

    cx = x(Corner[5] / x(Corner[3] - Corner[1]))

    cy = y(Corner[5] / y(Corner[3] - Corner[1]))

write this GeoGebra script for A, OnUpdate :

    SetCoords[b,cx (x(A)-x(Corner[1])),-cy (y(A)-y(Corner[3]))]


When attaching an input box to a point it places the point you choose in pixels.

SetCoords[InputBox, 100, 200] will place the input box 100 pixels to the right of the top left corner of the applet and 200 pixels below the top left corner of the applet.

In order to attach the input box to a point, you must convert the coordinates of the point to pixels, which I believe is what the previous user is demonstrating.

I use a variable called ScreenTopRightCornerInPixels and set it equal to Corner[5].

From there, you need a ScreenTopRightCornerInXAndY units and set it equal to Corner[3]

From there, you should be able to convert between the two, but as previous post mentioned, it can be complicated. For one thing, what if the pixels on your monitor are rectangular. I've rarely seen this, but whoa daddy!

© 2021 International GeoGebra Institute