Example: coordinates of a Point

coordinates of a point

You can use an Imput Box not only for giving the result of a calculation, but also for giving the coordinates of a point. In this case working with an inputbox for an empty text works fine. In this method the filled in coordinate is assigned to the object Ans. In next applet one has to give the coordinates of a point. See how it works and make it yourself following the construction steps. So we get:
  • Ans = (pi, pi) to start with an answer that certainly doesn't equal the solution
  • text1 = "" is an empty text
  • Create an inputbox for the object text1 with a scripting command SetValue(Ans, %0) to assign the filled in coordinates to Ans.

Construction Steps

1Type the command a = RandomBetween[-5, 5] to create a number a.
2Type the command b = RandomBetween[-4, 4] to create a number b.
3Type the command Sol=(a, b) to create a point Sol. Note 1: Be careful to use a capital. If you don't you will create a vector instead of a point. Note 2: Rightclick on it to open the properties and define the title as P.
4Type the command Ans=(pi, pi) to create a point Ans.
5Type the command empty = "" to create an empty text.
6Type the text Give the coordinates of P in the Graphics.
7Toolbar ImageSelect the Input Box Tool and create an Innput Box with label = , linked to the object empty. Rightclick on it to open the properties of the Input Box: - In the tab scripting type in On Click the command SetValue[Ans, %0]. - In the tab Advanced define the Dynamic Colors for feedback (see below).
8Toolbar ImageSelect the Button Tool to create a button with label new exercise and as commands - UpdateConstruction[] - SetValue[empty, ""] - Setvalue[Ans, (pi, pi)]

Dynamic Colors of the Input Box

Dynamic Colors of the Input Box