Capturing text input

The
qnx.fuse.ui.text package contains the classes required
for displaying text on the screen and for gathering text input from the user.

The
Label class enables you to display formatted text within
your application. The
Label class cannot be used to gather text input, and it
cannot get input focus.

The
TextInput class enables you to create a single -ine text
field that the user can use to enter text. The
TextArea class enables you to create a multi-line text
field that the user can use to enter text. When a
TextInput or
TextArea instance gains focus, the keyboard
automatically appears enabling the user to enter text into the field. You can
define the type of keyboard that appears, depending on the context of the
current application.

Create a text input field

When the user clicks in a text input field, the keyboard appears. You
can define the type of keyboard for each text input field. The keyboard type
defines the layout of the keyboard, including the types of keys, and the Return
key type. The following task demonstrates how to create a text input field that
enables the following keyboard.

In the
initializeUI function, set the keyboard type and
keyboard
Enter key type. In the following code sample,
the text input field is used to type a URL to connect to a remote server. The
URL keyboard is specified (by specifying the
KeyboardType.URL constant), and the
Enter key is set to use the
Connect key.

In the
initializeUI function, set the
clearIconMode property. By default, the text input
field contains a clear icon that the user can click to clear the text input
field. The icon is enabled by default, however you can define when the icon is
available to the user.

myInput.clearIconMode = TextInputIconMode.UNLESS_EDITING;

In the
initializeUI function, add the text input field to
the stage.

this.addChild(myInput);
}
}

Create a text input area

The following task demonstrates how to create
aTextArea that enables the email keyboard type, and the
default return key.

In the
initializeUI function, set the keyboard type and
keyboard
Enter key type. In the following code sample,
the text input field is used to type a URL to connect to a remote server. The
EMAIL keyboard is specified (by specifying the
KeyboardType.EMAIL constant).