Difference between revisions of "Scripting"

From GeoGebra Manual
Jump to: navigation, search
Line 1: Line 1:
 
<noinclude>{{Manual Page}}[[Category:Manual (official)|{{PAGENAME}}]]</noinclude>
 
<noinclude>{{Manual Page}}[[Category:Manual (official)|{{PAGENAME}}]]</noinclude>
{{objects}}
+
{{objects|property}}
 
GeoGebra supports two scripting languages -- GGBScript and Javascript. Script is a sequence of actions which can be triggered by  
 
GeoGebra supports two scripting languages -- GGBScript and Javascript. Script is a sequence of actions which can be triggered by  
 
* clicking or updating particular object
 
* clicking or updating particular object

Revision as of 22:05, 24 January 2011


GeoGebra supports two scripting languages -- GGBScript and Javascript. Script is a sequence of actions which can be triggered by

  • clicking or updating particular object
  • loading the file (in case of Javascript)
  • Javascript listeners (see Reference:JavaScript)

You can set this script via Scripting panel of Properties Dialog.

GGBScript

You can create scripts consisting of GeoGebra commands.

Example:
  • a is an integer-valued slider
  • <code>list1={"red","green","blue"}</code>
  • in properties of a set On Update script to SetCaption[a,Element[list1,a]
  • by moving the slider you change its color


JavaScript

JavaScript is a programming language used by many internet technologies. Unlike GGB Script, in Javascript the commands don't have to be executed as a simple sequence, but a control flow (if, while, for) can be used. For generic JavaScript you can find a nice tutorial on w3schools.com. In GeoGebra, you can use special JavaScript commands which allow you to change the construction.

Example:


Complete list of available commands can be found in Reference:JavaScript. GeoGebra contains its own JavaScript engine. When exported as Dynamic Worksheet one can chose whether to use this engine or the one contained in browser in applets.

Comments

© 2024 International GeoGebra Institute