format

Form XML code

Possible values

Associated containers, widgets, and theme elements

Associated 4gl statements and ui methods

Influence and behavior

Formatting numeric form fields

Formatting DATE form fields

Using ui methods

format specifies how the entered data is displayed after you exit the form field.

Form XML code:

<TextField ... format="#,###.##"/>

or

<Calendar ... format="mm/dd/yy"/>

Possible values:

a string of characters that can include

Associated containers, widgets, and theme elements:

Calendar

FunctionField

TextField

TimeEditField

Associated 4gl statements:

INPUT

Associated ui methods:

setFormat

getFormat

Influence and behavior:

format doesn't affect the way how the entered values are stored to the corresponding variables.

It effects only the way how they are displayed when you exit the form field.

With numeric form fields – of the DECIMAL, SMALLFLOAT, and FLOAT data types, – format is used to specify the location of the decimal point and the digit grouping symbol.

In this case, the format pattern is a string of characters that can include

For example,

At runtime, it will look like this (the 1st field):

The value that will be stored in the corresponding variable after input doesn't depend on format. It depends only on the variable's data type.

For example,

DEFINE f1, f2, f3 DECIMAL(16,2)

 

In format, you set the number of digits that can be displayed to the input field – by the number of # used in the pattern:

Field overflow has no effect on the receiving variable.

For example, for form fields with format="#,###.##", format="####.##", and format="####" you get:

 

With DATE form fields, format is used to specify how your entered dates are displayed.

In this case, the format pattern is a string of characters that can include these special symbols:

dd

day of the month from 01 up to 31 (depends on the month)

ddd

day of the week as a three letter abbreviation (Mon, Tue, etc.)

mm

month of the year from 01 to 12

mmm

month of the year as a three letter abbreviation (Jan, Feb, etc.)

yy

year of the century in the two-digit representation (from 00 to 99)

yyyy

year in the four-digit representation (from 0000 to 9999)

Any other characters will be interpreted as literals and displayed in those places of the pattern where you put them.

For example, for the form fields with these settings

<not set>

format="mm/dd/yy"

format="mmm dd, yyyy"

format="yymmdd"

format="dd-mm-yy"

format="(ddd.) mmm. dd, yyyy"

you will see this after input at runtime:

The value that will be stored in the corresponding variable after input doesn't depend on format. It depends only on the variable's data type:

 

At runtime, you can use the ui method – setFormat() – to specify the pattern for the data entry:

LET widget_var = ui.<widget>.ForName("widget_id1")

CALL widget_var.setFormat("...")

For example,

CALL tf.setFormat("###,###.##")

or

CALL cld.setFormat("mmm dd, yyyy")

The corresponding getter – getFormat() – is used to retrieve the comment text:

CALL widget_var.getFormat()

 

 

Contact Us

Privacy Policy

Copyright © 2024 Querix, (UK) Ltd.