Difference between revisions of "Tutorial:Introduction to GeoGebraScript"

From GeoGebra Manual
Jump to: navigation, search
Line 20: Line 20:
 
* Create a Button using Button Tool
 
* Create a Button using Button Tool
 
* Enter for caption the visible label ob the button
 
* Enter for caption the visible label ob the button
* Enter the script <code>SetValue[Steps,Steps+1]</code> oder simply <code>Step=Step + 1</code></div>}}
+
* Enter the script <code>SetValue[Steps,Steps+1]</code> or simply <code>Steps=Steps + 1</code></div>}}
  
 
To decrement change "+" to "-". To change the size of the steps change 1 to your value.
 
To decrement change "+" to "-". To change the size of the steps change 1 to your value.
  
 
{{Note|1=The command <code>Step=Step + 1</code> is only avaiable in scripting. If you enter a command like that in the input bar, you'll get an error '''circular definition'''}}
 
{{Note|1=The command <code>Step=Step + 1</code> is only avaiable in scripting. If you enter a command like that in the input bar, you'll get an error '''circular definition'''}}

Revision as of 19:01, 6 November 2011

GeoGebraScript is a simple way to write scripts in GeoGebra.

Useable Commands

There are not only tools to create an object in GeoGebra. You can do the same with commands and the input-bar.

Example: With the command Circle[(1,2),3] you'll get a circle with the midpoint (1,2) and the radius 3.


Even if you use the tools to create an object, the command to get this object via input bar can be found in the Properties Dialog behind Definition. So, tools are more or less only a help to enter thoose commands with the mouse. A list of all commands to create an object can be found here.

But there are some commands that do no create an object. These commands are especially for scripting. See Scripting_Commands.

Every object can be used to start an objects. Clicking or moving a point can be used too. But there are some objects that are created specially to use it for scripts: buttons and textfields. Here are some examples how to use them.

Buttons

Increment/Decrement Buttons

Instead of using a slider to go through a step-by-step explanation, you can use a button.

Example:
  • Create an integer slider, called Steps.
  • Create a Button using Button Tool
  • Enter for caption the visible label ob the button
  • Enter the script SetValue[Steps,Steps+1] or simply Steps=Steps + 1


To decrement change "+" to "-". To change the size of the steps change 1 to your value.

Note: The command Step=Step + 1 is only avaiable in scripting. If you enter a command like that in the input bar, you'll get an error circular definition
© 2022 International GeoGebra Institute