This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
button [2020/12/01 10:04] justin |
button [2020/12/01 10:04] (current) justin |
||
---|---|---|---|
Line 20: | Line 20: | ||
You can access and change certain properties of a button from within a [[script]] by simply referencing the parent [[widget]] and the button element by their unique IDs. See below for examples of changing the text, [[image]], and [[script]] of a button. In these cases, the [[widget]] has an ID of "test" and the button has an ID of "0001". | You can access and change certain properties of a button from within a [[script]] by simply referencing the parent [[widget]] and the button element by their unique IDs. See below for examples of changing the text, [[image]], and [[script]] of a button. In these cases, the [[widget]] has an ID of "test" and the button has an ID of "0001". | ||
- | Changing a button's text: | + | **Changing a button's text:** |
<code bauxite> | <code bauxite> | ||
widget["test"].element["0001"].text = "New Text" | widget["test"].element["0001"].text = "New Text" | ||
</code> | </code> | ||
- | Changing a button's image: | + | **Changing a button's image:** |
<code bauxite> | <code bauxite> | ||
widget["test"].element["0001"].image = "new_image.png" | widget["test"].element["0001"].image = "new_image.png" | ||
</code> | </code> | ||
- | Changing a button's script: | + | **Changing a button's script:** |
<code bauxite> | <code bauxite> | ||
widget["test"].element["0001"].script = "new_script_name" | widget["test"].element["0001"].script = "new_script_name" |