Workbench User Guide : 9. Generating Fields from Predefined Templates : How You Can Add a Generated Field to a Frame : The analog_clock Field Template
 
Share this page                  
The analog_clock Field Template
The analog_clock field template displays the time of day using a standard analog clock face (with hour and minute hands) and supports optional alarms that users can set. The clock operates and updates its display automatically.
Create an Analog Clock Field
You can create an analog clock field using the analog_clock field template in the Frame Editor.
To create an analog 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 analog_clock template, and then click OK.
4. Position the field on the frame.
The Analog Clock Assistant appears.
The sample shown in the Assistant (in the upper left corner) reflects the time the dialog is opened and its display is updated, as specified.
5. Complete the dialog using the following information:
Enable Alarms
If enabled, lets the user set alarms
Display Seconds
If enabled, displays seconds in the analog clock
Time Zone
Specifies the time zone to use:
Default
Specifies the default time zone of GMT
Selected
Opens a list field, letting the user select another time zone
6. Click Generate.
The field is created and displayed in the Frame Editor:
Note:  If you shrink or move the rectangle, the bell alarm icon will be repositioned automatically at runtime. Also, if the clock is made small enough, only the 5‑minute interval ticks will be visible.
How an Analog Clock Field Works
When you run the frame containing the analog clock field, it displays the current time. The clock operates automatically and updates its display as specified. If you chose to display seconds, each individual second tick becomes red in turn to show the seconds.
An example of an analog clock display follows. Note that the second indicator is shown on the 11th second:
Setting Alarms
If the Enable Alarms feature is selected when the analog clock is created, the user can set alarms by clicking the clock, which opens the Timer Options dialog.
In this dialog, the user can set one or more alarms. The control button provides several options including inserting a row, deleting the current row, or deleting all rows. These functions are those provided in a table field frame (for more information, see 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 PM).
Memo/Event Field
The Memo/Event field is used to enter a message to be displayed at the time of the alarm event.
Alarm Status
When the Status option is checked, the selected alarm is set.
When an alarm is set, a bell icon appears at the right edge of the analog clock field as an indicator. Alarms are active only while the frame containing the analog clock is running.
Alarm Messages
When an alarm is triggered, a message box appears containing the message associated with the alarm.
The timekeeping and display functions of the analog_clock field and the digital_clock and elapsed_timer fields are handled by a number of user classes. All three fields are based on the timer_manager user class, which in turn uses several private classes and subclasses to perform its functions. For more information, see the appendix "Generated User Classes" in the Language Reference Guide.