Glimmr Form Fields
version 1/101201 by Erik Temple
Section: Brief overview of Glimmr Form Fields
Any kind of graphic element can be identified as an input field, and this field is associated via a property with the rendered string g-element that will display its text (see below). When the input field element receives a mouse click (or, alternatively, a command), the "accepting field input" action is triggered, and the game will enter a new keystroke-based input loop (the "field char input" loop--see Glulx Input Loops for more on input loops). This character input is taken in the main text window, but it will seem to the player that she is transparently typing into the field: Each time the player presses a key in this special loop, the text-string associated with the field's rendered string element will be updated with the character entered, and the graphics window refreshed so that this is reflected in the graphical representation of the text. When the player presses a key defined as terminating input, we stop the input loop and complete the accepting field input action.
There are three main steps to implementing an input field:
1) Declare the field itself.
2) Declare the element that will display text in the field.
3) Access the player's input to the field and act upon it.
The following sections elaborate on these steps and on the basic options available within them.