# Drag the Point

## Exercises "Draw..."

We often give students drawing exercises: "Draw a point, draw a line, draw a rectangle...", so why shouldn't we in GeoGebra? Drawing in GeoGebra is no problem, but controlling is. The problem is the syntax in controlling an object that isn't created yet. While working e.g. with polygons you could eventulally do with commands as Execute[{"SetColor[poly"+nr+",red]"}] to give feedback in coloring, for you know in English new created polygons will be called poly1, poly2, etc. But this command will be recognised only by users whose language setting is English, since e.g. in German a new polygon is called Vieleck1, in Italian poli1 etc. An easier alternative is to create a polygon which you have to modify to fit the exercise. In this option language setting is no problem and you don't have to struggle with complicated Execute-syntaxes in scripts.

## Drag the point

In next exercise you have to draw a point with given coordinates. Watch how it works and then make it yourself following the given Construction Steps.

## Construction Steps

 ﻿1 ﻿ ﻿Type the command a = RandomBetween[-4, 4] to create a number a. ﻿2 ﻿ ﻿Type the command b = RandomBetween[-4, 4] to create a number b. ﻿3 ﻿ ﻿Type the command Sol = (a, b) to create a point Sol. ﻿4 ﻿ ﻿Type the command P = (-5, 5) to create a point P out of the range of the coordinates of Sol. Rightclick on it to set its dynamic colors (see below). ﻿5 ﻿ ﻿Select the Button Tool and create a button with caption new exercise and scripting commands UpdateConstruction[] to recalculate a and B. SetValue[P,(-5,-5)] to set back the point P to its initial position ﻿6 ﻿ ﻿Create the dynamic text Drag P so that P =(a, b) and select a and b in the list of available objects.
Hint: Open the Toggle Style Bar of the Graphics and set the Point capture style to Fixed to Grid.