Glimmr Form Fields

version 1/101201 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next



  • Chapter: Defining the input field

    GFF allows you to identify any number of graphic elements as input fields. This is done by setting the form input property of the element:

        My form field is a rectangle primitive. It is form input. The graphlink status is g-active.

    As shown, we also need to make the field receptive to mouse input, via the "graphlink status" property.

    Any type of graphic element can be designated form input. The field is primarily a zone of the screen that is intended for mouse interaction--the player clicks on a field to activate field text entry. Note that the player needs to be able to click within the dimensions of the element to activate the field. So, a thin horizontal line would not be appropriate in most cases, because this would force the player to click on the one-pixel wide line. Better would be to use a PNG image with transparency (sprite element) to display the horizontal line, with space above the line left transparent to provide a zone for the player to touch with the mouse. (Another approach is to simply write a custom element display rule to display the field and define the clickable zone as desired; see the documentation for Glimmr Canvas-Based Drawing.)

    GFF provides an optional way to define input fields, the "input field" kind. This is a subkind of g-element, and for this kind the form input and graphlink status properties are automatically set, which can save some typing. Most users will also want to declare a more specific kind for the input field (otherwise nothing will be drawn to the screen). This can be done like so:

        An input field is a kind of rectangle primitive.