「SetValue 指令」修訂間的差異

出自GeoGebra Manual
前往: 導覽搜尋
(Autogenerated from properties)
 
行 1: 行 1:
<noinclude>{{Manual Page|version=4.0}}</noinclude>{{command|scripting|SetValue}}
+
<noinclude>{{Manual Page|version=5.0}}</noinclude>{{command|scripting}}
;SetValue[ <Boolean>, <0|1> ]
+
;SetValue( <Boolean>, <0|1> )
:{{translate|SetValue Command}}
+
:Sets the state of a boolean / check box : 1 = true, 0 = false
;SetValue[ <Object>, <Object> ]
+
:{{example|1=If  ''b'' is a boolean, <code> SetValue(b,1)</code> sets the boolean ''b'' as ''true''.}}
:{{translate|SetValue Command}}
+
 
;SetValue[ <List>, <Number>, <Object> ]
+
;SetValue( <Object>, <Object> )
:{{translate|SetValue Command}}
+
:Let''A'' be the first and ''B'' the second object. If ''A'' is a [[Free, Dependent and Auxiliary Objects|free object]] or a [[Points and Vectors|Point]] restricted to [[Geometric Objects#Paths|Path or Region]], its value is set to current value of ''B'' (i.e. ''A'' doesn't change value if ''B'' is changed afterwards).
 +
:{{example|1=If  ''f'' is a function, <code>SetValue(f, RandomElement({cos(x), 3x+2, ln(x)}))</code> defines, at random, f as being one of the functions proposed in the list.}}
 +
 
 +
 
 +
;SetValue( &lt;List>, <Number>, <Object> )
 +
:Let ''n'' be the ''<Number>''. The command SetValue sets the n-th element of a free list to the current value of the object. Number ''n'' can be at most 1 + length of L.
 +
 
 +
 
 +
;SetValue( <[[Action_Objects#Drop-down lists|drop-down list]]>, <Number n > ) : Set  ''n'' as [[SelectedIndex_Command| the index of the selected element]] in the drop-down list.

於 2021年7月27日 (二) 09:52 的修訂

Accessories dictionary.png
本頁為官方文件,一般使用者無法修改,若有任何誤謬,請與官方聯絡。如欲編輯,請至本頁的開放版


SetValue( <Boolean>, <0|1> )
Sets the state of a boolean / check box : 1 = true, 0 = false
範例: If b is a boolean, SetValue(b,1) sets the boolean b as true.
SetValue( <Object>, <Object> )
LetA be the first and B the second object. If A is a free object or a Point restricted to Path or Region, its value is set to current value of B (i.e. A doesn't change value if B is changed afterwards).
範例: If f is a function, SetValue(f, RandomElement({cos(x), 3x+2, ln(x)})) defines, at random, f as being one of the functions proposed in the list.


SetValue( <List>, <Number>, <Object> )
Let n be the <Number>. The command SetValue sets the n-th element of a free list to the current value of the object. Number n can be at most 1 + length of L.


SetValue( <drop-down list>, <Number n > )
Set n as the index of the selected element in the drop-down list.

Comments

在程式腳本中使用 SetValue 指令[編輯]

若想要在程式腳本中更改某物件的值,強烈建議使用 SetValue 而不是等號(=)。詳情請參閱效能良好的圖檔

© 2022 International GeoGebra Institute