Please enable JavaScript to view this site.

CWT User Interface Design Handbook

Navigation: TFT Controls

TextBox (TFT)

Scroll Prev Top Next More

<TFT:TextBox Name='CodeInput'

Description

The TextBox control is used for textual input in the user interface. The control can, for instance, be used to input the customer's identity during a purchase or to select articles based on names. TextBox is defined as a separate control in panels that allow textual input.

You can only have one TextBox per panel.

Warning:
The TextBox is limited to 19 characters when used as CodeInput. When allowing more than 19 characters the CWT will crash when more than 19 characters are read to the application

Properties

AdjustFontSize

Type/Value: True/False (default = False)

Description:Automatically adjust to smaller font size when entered text does not fit the textbox

BackColor

Type/Value: A string with a valid colour name

Description:Defines the background colour of the text box. The background of the text box will be filled with this colour. See Colour names for a list of available colours.

Characters

Type/Value: string.

Description:String of allowed characters. If empty or not assigned all characters are allowed. E.g. “0123456789” only digits

Warning: The TextBox is limited to 19 characters when used as CodeInput. When allowing more than 19 characters the CWT will crash when more than 19 characters are read to the application

Font

Type/Value: A font formatting string.

Description:the text and the text style (like normal, bold or italic). This can be set for each label. Format: “[Font name], [Font size], style=[Font style]”. A typical example is “Arial, 24pt, style=Regular”.

See Fonts for available font names.

The available styles are:

Regular

Bold

Italic

Strikeout

Underline

NOTE: It is possible to use any custom True Type font by placing a font file in the folder “\Storage Card\Media\Fonts\” and using the font name for that particular font file.

ForeColor

Type/Value: A string with a valid colour name

Description:Defines the label's foreground colour. The text in the label will be rendered with this colour. See Colour names for a list of available colours.

Height

Type/Value: Unsigned integer with value range: 0–128

Description:The Height property controls the height of the text box when it is rendered to the display. The height is set in number of pixels.

NOTE: If the text doesn’t fit in the specified height (the font size is too big for the height of the text box) no text will be rendered to the text box. Try to increase the height.

HideWhenEmpty

Type/Value: Boolean, use “true” or “false”

Description:Defines if the text box should be hidden when there is no text in text box. This property enables a description label to be shown, e.g. “Enter license plate”, when nothing is entered. And the description will disappear when text is entered since the text box will be shown above the description. (In ui.xaml define the description label after the text box)

HorizontalAlignmentBySize

Type/Value: True/False (default = False)

Description:Defines if the text box should be hidden when there is no text in text box. This property enables a description label to be shown, e.g. “Enter license plate”, when nothing is entered. And the description will disappear when text is entered since the text box will be shown above the description. (In ui.xaml define the description label after the text box)

Location

Type/Value: String in format “X,Y” where X and Y are both unsigned integers. Value range for X is 0 – 260 and value range for Y is 0 – 128.

Description:The Location property specifies where the text box shall be placed in relation to the parent control. If a text box is defined in a panel the Location property will specify where inside the panel the text box will be positioned. The physical position on the display will then depend on where the panel is placed (panels also have a Location property) and where the text box is placed.

KeyValue

Type/Value: String

Description:Used by GlobalInputTextBox. KeyValue defines the key and the entered text in the textbox is the value in Global Input key-value pair.The key is translated via translation.xml when presented in GlobalInputListView

MaskChar

Type/Value: One single character

Description:Set MaskChar to a one character string to enable masking of the text input. If, for instance, MaskChar is set to “*” all characters that are input will be displayed as * instead. The actual character entered will, however, be stored and processed as usual by the software.

MaximumLength

Type/Value: Unsigned integer with value range 1–100

Description:Defines the maximum number of characters than can be entered in the text box. No text will be accepted if this value is exceeded.

MinimumLength

Type/Value: Unsigned integer with value range 0–100

Description:Defines the minimum length of input (in number of characters) before the input will be accepted. If the button used to accept the input has Name=”CodeDoneButton” it will remain invisible or inactive until this minimum input requirement has been reached.

Multiline

Type/Value: Boolean, use “true” or “false”

Description:Defines if the text input in the text box is allowed to occupy more than one row. Usually set to "false".

Name

Type/Value: A string of any length

Description:The identifier of the TextBox. If a text box shall allow character input from the keyboard presented in the TFT display, the Name property must be set to the following to enable the software to find the text box:

AccessControlEnforcementPaybySpaceEndTextBox

AccessControlEnforcementPaybySpaceStartTextBox

AccessControlInput

ArticleNameInput

CodeInput

ExternalPayUnitInput

ExternalPayUnitUserIdentifierInput

GeneralInput

GetExternalInformationInput

InputTextBoxOffTrackLabel

PersonalAccountIdentifierInput

PersonalAccountPinInput

PhoneNumberFormatCountryCodeInput

PinInput

PreviousPurchaseIdentifierInput

PurchasePreRequisitesCodeInput

PurchasePreRequisitesIdentifierInput

RemainingTimeIdentifierInput

RemainingTimePinCodeInput

SpaceInput

TextInputExtPUId

TextInputParkingId

TextInputTerminalId

TicketForwardingEmailAddressInput

TicketForwardingPhoneNumberInput

TicketForwardingPhoneNumberOrEmailAddressInput

TopUpIdCodeInput

TopUpIdInput

UserIdentifierInput

NOTE: This implies that only one text box can be used for character input in each panel because the Name property must be unique in each panel.

OffTrackBackColor

Type/Value: String with the format "R,G,B" or default HTML color names

e.g. "110,172,229" will give a light blue background.

"red" will result in "255,0,0" RGB notation.

Description:Make sure to use clear contrasts between the foreground color and the background color.

Best practice is Red background with white text

Sets the background color if the TextBox element to the specified color if the input does not match the RegEx and RegExValidExample parameters

OffTrackForeColor

Type/Value: String with the format "R,G,B" or default HTML color names

e.g. "110,172,229" will give a light blue text.

"silver will result in "192,192,192" RGB notation.

Description:Make sure to use clear contrasts between the foreground color and the background color.

Sets the background color if the TextBox element to the specified color if the input does not match the RegEx and RegExValidExample parameters

OutputFormat

Type/Value: Possible values are “USPhoneNumber”

Description:When the phone number is entered it is presented with the format (555) 123-4567. Only US numbers use this formatting, i.e. all numbers not starting with +, 0 or 1 and with exactly 10 digits. Phone numbers that not follow this rule will be displayed as digits only.

PostRegEx

Type/Value: String

Description:Regular Expression Pattern for validating entered text afterwards

If RegEx (see below) is used, the Done-button will not be visible until entered text is valid. With PostRegEx, the Done-button is always visible and the entered text is validated against PostRegEx after the Done-button is pressed. If the entered text is not valid, the CodeInputPostNotOkPopup is shown to inform the user that entered text is not valid and give them the option to go back and change or continue anyway.

PostRegEx is available for OnPurchasePreRequisitesIdentifierInputDone, OnPurchasePreRequisitesLoginAuthTokenInputDone, and OnPurchasePreRequisitesLoginAuthTokenAndIdentifierInputDone.

Example:PostRegEx="^[A-Za-z]{3}[0-9]{3}$"

PurchasePreRequisitesIdentifierInput

Type/Value: String

Description:Textbox name connected to Purchase pre-requisites identifier input.

RegEx

Type/Value: String

Description:Regular Expression Pattern for validating entered text.
If RegEx is used, the Done-button will not be visible until entered text is valid.

Example:RegEx="^[A-Za-z]{3}[0-9]{3}$"

RegExValidExample="ABC123"

RegExValidExample

Type/Value: string

Description:This parameter contains an example of what the RegEx result should look like

Example:RegEx="^[A-Za-z]{3}[0-9]{3}$"

RegExValidExample="ABC123"

When the input does not follow the expected format the colour of the TextBox will change according the settings in the OffTrackBackColor and OffTrackForeColor parameters.

ReferenceTextBox

Type/Value: String

Description:Used by click-function OnGeneralInputDone to auto populate the given ReferenceTextBox with the value from text box named GeneralInput. E.g. A GeneralInput TextBox to enter email address can have ReferenceTextBox="TicketForwardingEmailAddressInput" to auto populate the Ticket forwarding email address input to avoid entering email address again in the purchase flow

Size

Type/Value: String in format “A,B” where A and B are both unsigned integers. Value range for A is 0–640 and value range for B is 0–480.

Description:Defines both the height and the width of the text box with one property.

Example:  “640,480” sets the width to 640 pixels and the height to 480 pixels.

TextAlign

Type/Value: Possible values are “Near”, “Center” or “Far”

Description:The Alignment property defines where the rendering of text inside the text box shall start.

“Near” = Left justified.

“Far” = Right justified

“Center” = Centred.Width

Type/Value: Unsigned integer with value range 0–260

Description:The Width property defines the width of the text box in number of pixels. If the value is too small the software will render all parts that fit inside the text box and truncate the rest of the text. Then to fit all text in the text box, adjust the text box width or the font size, or both.

Warning: The TextBox is limited to 19 characters when used as CodeInput. When allowing more than 19 characters the CWT will crash when more than 19 characters are read to the application

 

Control information

To allow input of characters from the CWT 2120 keyboard presented in the TFT display, the text box must have the name “CodeInput” to allow the software to insert characters into it.

 

Examples

The example is named “CodeInput” to allow the insertion of characters into the text box through the keyboard presented in the TFT display. The text box is 100 pixels wide and 30 pixels high. Four characters have to be entered so both MinimumLength and MaximumLength properties are set to 4. The font is Tahoma in 24 points size and with bold style:

<TFT:TextBox Name='CodeInput'
  Size='100, 30'
  Location='20, 105'
  ForeColor='Black'
  BackColor='White'
  Multiline='False'
  MinimumLength='4'
  MaximumLength='4'
  Font='Tahoma, 24pt, style=Bold'/>