Workbench User Guide : Generating Fields from Predefined Templates : How You Can Add a Generated Field to a Frame : The digital_clock Field Template
 
Share this page          
The digital_clock Field Template
The digital_clock field template creates a digital clock that displays the time of day and supports optional alarms the user can set. You can choose either a 12- or 24-hour digital display format.
Create a Digital Clock Field
You can create a digital clock field using the digital_clock field template in the Frame Editor.
To create a digital clock field
1. On the Develop tab, in the Components portlet, open the frame in which you want to create the field from the field template.
2. Click Insert, Field From Field Template.
The Select a Field Template dialog appears.
3. Select the core application and the digital_click template, and then click OK.
4. Position the field on the frame where you want the upper left corner of the field to be located.
The Digital Clock Assistant appears.
5. Complete the dialog using the following information:
Enable Alarms
Specifies that the user will be able to set alarms
Display Seconds
Specifies that seconds are displayed on the digital clock
Display Format
Specifies whether the time should be presented in a 12‑hour format or a 24‑hour format
Time Zone
Specifies the time zone:
Default
Specifies the default time zone of GMT -5 Eastern (US, Canada)
Selected
Displays a list field that lets the end user select another time zone
6. Click Generate.
The field is created and displayed on the form.
How You Can Use a Digital Clock Field
When users run the frame containing the digital clock field, it appears displaying the current time. The clock operates automatically and updates its display every minute or second, as specified. An example of a 12‑hour clock display follows:
The following illustration of a digital clock displays the 24‑hour format:

Setting Alarms
If the Enable Alarms feature is chosen when the digital clock is created, the user can set alarms or switch between 12- and 24-hour format by first clicking the clock. This displays the Timer Options dialog.
In the Timer Options dialog, the user can set one or more alarms. The control button provides several functions including inserting a row, deleting the current row or deleting all rows. These functions are provided in a table field frame (for more information, see the description in Use a Table Field Frame).
Alarm Time
In the Time entry field, the user enters the time the alarm will be activated (for example, 12:00). When the 12 Hour option is in effect, the time entered should include AM or PM. If the 24 Hour option is in effect, AM or PM is not needed.
The clock format (12-hour or 24-hour) can be changed if alarms are enabled. You can switch from one mode to the other by selecting the appropriate radio button.
Memo/Event Field
Used to specify a description of the alarm event
Alarm Status
When the Status box is checked, the selected alarm is set.
When an alarm is set, a bell icon appears at the right edge of the digital clock field as an indicator. Alarms are active only while the frame containing the digital clock is running.
Alarm Messages
When an alarm is triggered, a message box appears containing the message associated with the alarm.
The timekeeping, display, and alarm functions of the digital_clock field are handled by the Timer_Manager user class, with a number of private user classes. For more information about the Timer_Manager class, see the appendix "Generated User Classes" in the Language Reference Guide.