Please enable JavaScript to view this site.

CWT User Interface Design Handbook

Navigation: STN controls

Label (STN)

Scroll Prev Top Next More

<Stn:Label Name='ExampleLabel1'>

Description

The Label control is used to display text on the screen. It can be static text defined by the creator of the user interface or dynamic text like the time and date in the terminal. All labels that shall display dynamic content must have a pre-defined name to enable the software to find and populate the label with the dynamic content. To define a label that display the current time in the terminal, Name must be set to “TimeLabel”. The appearance of the text in a label can be controlled with a number of properties for each label control.

 

Properties

All properties that can be defined for a label are listed below.

Alignment

Value:Near, Center, Far

Description:The Alignment property defines where the rendering of text inside the label shall start.
“Near” positions the text at the left edge.
“Far” means that the text will be positioned at the right edge.
“Center” means that the text will be centred.

Font

Type:Font formatting string.
Format: “FontName, FontSize, style=FontStyle”.

Description:The Font property defines the font used to render the text on the display as well as the size of the text and the text style. This can be set for each label.
The name, size and style of a font are all set in the Font property with the format “FontName, FontSize, style=FontStyle”.
A typical example is:

“Arial, 24pt, style=Regular”.

You can 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.

See also:Section Fonts for available fonts

 

FormattedText

Type:String of any length

Description:The FormattedText property defines the text to be rendered inside the label. Besides static text, the FormattedText property can contain special formatting commands and variables. The special syntax of the FormattedText property is described in Dynamic label text.

FormattingInfo

Type:String of any length.

Description:The FormattingInfo property can be used to adapt labels used to display time and date information. If the time or date formatting of the selected language must be changed, this can be solved with the FormattingInfo property. The formatting is controlled with the special formatting characters listed in Dynamic label text.

Height

Type:Unsigned integer with value range: 0–128

Description:The Height property (in number of pixels) controls the height of the label when it is rendered on the display.  

NOTE! — If the text does not fit in the specified height (the font size is too big for the height of the label) no text will be rendered to the label at all. Try to increase the label height.

Location

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

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

Example that places a panel named SamplePanel 10 pixels from the left display border and 10 pixels from the top border. The label will be placed 30 pixels from the left display border and 30 pixels from the top of the display:

<Stn:Panel
  Name='SamplePanel'
  Location='10,10'>
  <Controls>
     <Stn:Label
        Name='WhereLabel'
        FormattedText='Where?'
        Location='20,20'/>
  </Controls>
</Stn:Panel>

Name

Type:String of any length

Description:Label name. Must match one of the defined label names if the label shall be populated with dynamic text.

If the label shall display static text like “Welcome”, the name can be anything as long as it is unique within the panel where the label is defined. The Name property should always be set to make it match a defined name or make the label unique in the panel.

See also:For a complete list of key label names see Label names.

PartialErrorCheck

Type:Boolean value “true” or “false”

Description:PartialErrorCheck property activates a function that handles different states of a label depending on the terminal state. This is supported for the label with the key name “PaymentInstructionLabel”.

See also:details on how to use the label with key name “PaymentInstructionLabel” in Payment instruction label.

Text

Type:A string of any length

Description:The Text property can be used to present static text that does not require any formatting at all. If both the FormattedText and Text properties are defined, the setting of the FormattedText property will be used.

TextModeName

Value:WhiteText (default),
BlackText

Description:The TextModeName property defines if the text shall be rendered in black (default) or in white. If the text is rendered in white, the label background will automatically be rendered in black.
White text will be used if TextModeName is not defined for the pop-up panel.

Width

Type:Unsigned integer with value range 0–260

Description:The Width property defines the width (in number of pixels) of the label when it is rendered to the display.

If the value is set to 100, the label will occupy 100 pixels on the display. If the width is set to a too small value, the software will render all parts that fit inside the label and then truncate the rest of the text. To have all text fit inside a label the label width, or the font size (or both), need to be adjusted.

 

Control information

The terminal has a number of fixed label names that are used to display various kinds of information to the customer. One label, with a fixed key name, is used to display the current date; one is used to display how much the customer has paid, etc. Label names contains a list of all label key names and the information presented in each label.

 

Examples

The first example defines a label named “ExampleLabel1” that contains the static text “Example1” positioned at 50 pixels to the right of the left parent panel border and 30 pixels down from the top of the parent panel. The text is rendered in black and the label background is clear (default TextModeName is BlackText so no specific option is required to get the text in black). The text is centred horizontally inside the label area. The label is 120 pixels wide and 17 pixels high.

<Stn:Label Name='ExampleLabel1' FormattedText='Example1'
  Location='50, 30' Width='120' Height='17'/>

The next example defines a label that displays the current date of the terminal. The key name “DateLabel” is used and the software then fills the label with the current date. The date will be presented in the format “2009-04-01” by setting the FormattingInfo property to “yyyy-MM-dd”. The date label is inserted at position “30, 5” and is 50 pixels wide and 15 pixels high. See Label names for details on “DateLabel” key name of a label.

<Stn:Label   Name='DateLabel' FormattingInfo='yyyy-MMM-dd'
  Font='Arial, 10pt, style=Bold'
  Location='30, 5' Width='50' Height='15'/>