Difference between revisions of "Scripting"
(added v.4 - needs example) |
|||
Line 1: | Line 1: | ||
− | <noinclude>{{Manual Page}}[[Category:Manual (official)|{{PAGENAME}}]]</noinclude> | + | <noinclude>{{Manual Page|version=4.0}}[[Category:Manual (official)|{{PAGENAME}}]]</noinclude> |
{{objects|property}} | {{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 | ||
* loading the file (in case of Javascript) | * loading the file (in case of Javascript) | ||
Line 10: | Line 10: | ||
{{Example| | {{Example| | ||
* ''a'' is an integer-valued [[Slider Tool|slider]] | * ''a'' is an integer-valued [[Slider Tool|slider]] | ||
− | * < | + | * <code><nowiki>list1={"red","green","blue"}</nowiki></code> |
* in properties of a set On Update script to <code>SetCaption[a,Element[list1,a]</code> | * in properties of a set On Update script to <code>SetCaption[a,Element[list1,a]</code> | ||
* by moving the slider you change its color}} | * by moving the slider you change its color}} | ||
==JavaScript== | ==JavaScript== | ||
− | JavaScript is a programming language used by many | + | JavaScript is a programming language used by many Internet technologies. Unlike GeoGebra Script, in Javascript the commands don't have to be executed as a simple sequence, but a control flow (<code>if</code>, <code>while</code>, <code>for</code>) can be used. For generic JavaScript you can find a nice tutorial on [https://developer.mozilla.org/en/JavaScript/Guide developer.mozilla.org]. In GeoGebra, you can use special JavaScript commands which allow you to change the construction. |
{{Example|{{description}}}} | {{Example|{{description}}}} | ||
− | Complete list of available commands can be found in [[Reference:JavaScript]]. GeoGebra contains its own JavaScript engine. When exported as [[Dynamic Worksheet]] one can | + | Complete list of available commands can be found in [[Reference:JavaScript]]. GeoGebra contains its own JavaScript engine. When exported as [[Dynamic Worksheet]] one can choose whether to use this engine or the one contained in browser applets. |
Revision as of 12:34, 22 February 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.
- a is an integer-valued slider
list1={"red","green","blue"}
- 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 GeoGebra 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 developer.mozilla.org. In GeoGebra, you can use special JavaScript commands which allow you to change the construction.
Description of command / feature needed. Please enter it instead of this template into Manual:Scripting. so that it's included also to the public namespace. For more details see Project:HowTo |
Complete list of available commands can be found in Reference:JavaScript. GeoGebra contains its own JavaScript engine. When exported as Dynamic Worksheet one can choose whether to use this engine or the one contained in browser applets.