TIMEEDIT item type

Defines a line-edit field with a clock widget to pick a time.

TIMEEDIT item basics

The TIMEEDIT form item defines a field that allows the user to edit 24H time values, or time duration (intervals), with a specific clock widget for time input.

To store TIMEEDIT field values, consider using the appropriate DATETIME HOUR TO MINUTE or DATETIME HOUR TO SECOND data type depending on the target front-end.

Important: The display and input precision (with or without seconds) of the TIMEEDIT widget depends on the front-end. On some platforms, native time editors do not handle the seconds. Furthermore, some front-ends (especially on mobile devices) do not allow data types different from DATETIME HOUR TO {MINUTE|SECOND}. If the front-end does not support the data type used for the TIMEEDIT field, the runtime system will raise an error and stop the program. Consider testing your application with all types of front-ends.

On some front-ends, TIMEEDIT fields can also be used to handle INTERVAL values of the class HOUR TO {MINUTE|SECOND}, in order to input a time duration. Note however that in most cases the time interval pickers are limited to 24H hours and allow only positive values. As result, not all values allowed in an INTERVAL HOUR TO MINUTE variable (such as -86 hours 23 minutes) can be displayed by such widgets.

Defining a TIMEEDIT

No specific attribute is needed to define the rendering and behavior of a TIMEEDIT field. Common data validation attributes such NOT NULL, REQUIRED, DEFAULT are allowed.

Note: The time display format is automatically taken from the front-end platform settings. For example, time values can display in the 0-12 hour clock format (with AM/PM indicators), or in the 0-24 hour clock format.

The native widget used for TIMEEDIT fields usually allows only exact time value input, and therefore cannot be used with a CONSTRUCT instruction, where it must be possible to enter search filters like ">=11:00".

Front-ends support different presentation and behavior options, which can be controlled by a STYLE attribute. For more details, see Common style attributes.

Detecting TIMEEDIT modification

To inform the dialog when a date is picked from the clock widget, define an ON CHANGE block for the TIMEEDIT field. The program can then react immediately to user changes in the field:

-- Form file (grid layout)
TIMEEDIT de1 = order.ord_shiptime,
   NOT NULL;

-- Program file:
ON CHANGE ord_shiptime
   -- A new time value was picked from the clock widget

For more details, see Reacting to field value changes.

Where to use a TIMEEDIT

A TIMEEDIT form item can be defined in different ways:
  1. With an item tag and a TIMEEDIT item definition in a grid-layout container (GRID, SCROLLGRID and TABLE).
  2. As a TIMEEDIT stack item in a STACK container.

Field input length

The input length in a TIMEEDIT fields is defined by the (DATETIME) program variable. In a grid-based layout, define an item tag wide enough to fit all time value digits (5 positions for HH:MM, 7 positions for HH:MM:SS). For more details, see Input length of form fields.