Workbench User Guide : 9. Generating Fields from Predefined Templates : How You Can Add a Generated Field to a Frame : The gauge Field Template
 
Share this page                  
The gauge Field Template
The gauge field template is used to create a thermometer‑style bar gauge that can be used to monitor progress, resource levels, or other numeric data in your application. You have full control over the size, orientation, labeling, and range of the gauge. The value of the gauge is typically set and updated at runtime.
Create a Gauge Field
You can create a gauge field using the gauge field template in the Frame Editor.
To create a gauge 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 gauge template, and then click OK.
4. Position the field on the frame.
The Gauge Assistant appears.
5. Complete the dialog using the following information:
Minimum
Specifies the lowest value in the gauge field
Initial
Specifies the initial value in the gauge field
Maximum
Specifies the highest value in the gauge field
Number of Divisions
Specifies the number of divisions in the gauge field. You can select between five, eight, or ten.
Default: Ten
Auto Range
Specifies that the end points of the gauge field will be adjusted automatically if the values exceed the specified minimum or maximum values
Direction of Indicator Movement
Specifies the desired direction of movement (minimum to maximum value) of the gauge
Edge to Place Ticks
Specifies the location of the tick marks on the gauge
High
Causes a high mark to be drawn on the gauge, indicating the highest value received since the frame began running
Low
Causes a low mark to be drawn on the gauge, indicating the lowest value received since the frame began running
Alarms
Specifies that messages are sent to the user if the gauge values meet preset conditions. A control appears in the Assistant window that lets you set the conditions, test values, and messages.
6. Click Generate.
The field is created and displayed on the form.
How You Can Customize a Gauge Field
At runtime, the value of the gauge is initialized to its minimum value. To update the current value of the gauge as your frame executes, call the UpdateGaugeValue method for the field. For example:
declare
PercentComplete = float;
enddeclare
{
PercentComplete = RowsProcessed / TotalRows;
MyGauge.UpdateGaugeValue(value =
          PercentComplete);
}
How a Gauge Field Works
The value of the gauge is typically set and updated at runtime. An example of a gauge field that uses the default parameters in the Gauge Assistant dialog appears as follows:
The actual processing for the gauge field is handled by the Indicator_Manager user class, which in turn relies on additional private user classes to assist in gauge layout and drawing. For more information about the Indicator_Manager class, see the appendix "Generated User Classes" in the Language Reference Guide.