Text

From MegaZine3
Jump to: navigation, search
ASUL Component
Tag name text
Extends Box

This component represents a text box, either to be used for input or just as a label.

Attributes

align

  • Type: {left, right, center, justify}
  • Default: left

Determines the text alignment.

autosize

  • Type: Boolean
  • Default: false

Determines whether to automatically adjust the element's size based on its text contents.

bold

  • Type: Boolean
  • Default: false

Determines whether to display text as bold.

color

  • Type: Integer
  • Default: 0x000000

The text color to use.

font

  • Type: String
  • Default: Times New Roman

The font to use for the displayed text. Note that only common fonts and system fonts (e.g. _sans) should be used here, unless the font is somehow embedded in the Flash file. Otherwise the visible result may differ based on the fonts installed on the user's computer.

input

  • Type: Boolean
  • Default: false

Determines whether this is an input field, i.e. if the user can write text into this field, or not, i.e. to behave like a label.

italic

  • Type: Boolean
  • Default: false

Determines whether to display the text in italics.

maxchars

  • Type: Integer

The maximum number of characters this text field may display. Primarily meant to be used for input text.

multiline

  • Type: Boolean
  • Default: false

Determines whether to allow the text to flow over multiple lines, or ignore linebreaks and display all text in one single line.

password

  • Type: Boolean
  • Default: false

Determines whether the text field is a password field, i.e. if plain text should be displayed (false) or *s for each character (true).

restrict

  • Type: String

Restrict the allowed input characters to the characters in this list. Per default, all characters are allowed.

selectable

  • Type: Boolean
  • Default: false

Determines whether to allow users to select text in this text field or not.

size

  • Type: Integer
  • Default: 12

The font size to use.

underline

  • Type: Boolean
  • Default: false

Determines whether to underline the displayed text.

value

The text to display if a string is given. If a definition is given, it is checked if it's a valid localization definition of the format: localize(LNG_ID, Default string)

If it is, and a localization is known, this will display the correct localization, and the default string per default. If the definition is somehow invalid, it is treated like a normal string.

wordwrap

  • Type: Boolean
  • Default: false

Indicates whether the text field has word wrap, i.e. if a new line should start when the text cannot be fit in one single line.

Examples

<text
    restrict="0123456789"
    maxchars="10"
    selectable="true"
    input="true"
    font="_sans"
    size="20"
    value="123"
    anchors="0,0,pw,ph"
/>

Results in the following:

ASUL-related articles
Components Box · Button · ProgressBar · ScrollBar · ScrollPane · Text · ToggleButton · Window
Layouts Horizontal Flow Layout · Vertical Flow Layout
ASUL Articles ASUL Document · Editing the GUI · Layouting · ASUL scripting