User Tools

Site Tools


text_field

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
text_field [2020/12/02 18:48] justintext_field [2020/12/06 21:11] (current) justin
Line 8: Line 8:
 |{{:wiki:tag_id.png?nolink|}}|Element ID|ID for the text field. This ID must be unique amongst other elements within the same [[widget]]. It is currently auto-generated but will be editable in a future update.| |{{:wiki:tag_id.png?nolink|}}|Element ID|ID for the text field. This ID must be unique amongst other elements within the same [[widget]]. It is currently auto-generated but will be editable in a future update.|
 |{{:wiki:text.png?nolink|}}|Text|Text that will be displayed in the text field.| |{{:wiki:text.png?nolink|}}|Text|Text that will be displayed in the text field.|
-|{{:wiki:eye.png?nolink|}}|Read-Only| |+|{{:wiki:eye.png?nolink|}}|Read-Only|Determines whether or not the field's text can be edited. When read-only is enabled, the player won't be able to type into the field.|
 |{{:wiki:font.png?nolink|}}|Font|[[Font]] that will be used for the field's text. If the "Default" option is selected, your game's default dialogue [[font]] will be used.| |{{:wiki:font.png?nolink|}}|Font|[[Font]] that will be used for the field's text. If the "Default" option is selected, your game's default dialogue [[font]] will be used.|
 |{{:wiki:font_size.png?nolink|}}|Font Size|[[Font]] size to use for the field's text.| |{{:wiki:font_size.png?nolink|}}|Font Size|[[Font]] size to use for the field's text.|
  
 =====Scripting===== =====Scripting=====
-You can access and change certain properties of a text field from within a [[script]] by simply referencing the parent [[widget]] and the element by their unique IDs. See below for an example of changing the field's text. In this case, the [[widget]] has an ID of "test" and the text field has an ID of "0001".+You can access and change certain properties of a text field from within a [[script]] by simply referencing the parent [[widget]] and the element by their unique IDs. See below for examples of both changing the field's text and storing the field's text into a variable. In this case, the [[widget]] has an ID of "test" and the text field has an ID of "0001".
  
-**Changing a button's text:**+**Changing a field's text:**
 <code bauxite> <code bauxite>
 widget["test"].element["0001"].text = "New Text" widget["test"].element["0001"].text = "New Text"
 +</code>
 +
 +**Storing a field's text into a variable:**
 +<code bauxite>
 +$name = widget["test"].element["0001"].text;
 +display_message("Hello, " + $name + "!")
 </code> </code>
  
 ~~NOTOC~~ ~~NOTOC~~
text_field.txt · Last modified: 2020/12/06 21:11 by justin