.NET Example: Control Properties/Simple Event and Script

Some .NET controls can be almost completely configured, if not completely, using the properties in the control's Properties - Object dialog box>Control Properties.

A linear gauge, which is available in the .NET Component Browser, is one of these controls. With Control Properties configuration, a Periodic event and simple script, the gauge can display a selected point's values.

Note: The gauge will be configured to report the value of a point PROCESS_VISCOSITY.

Point attributes include the following.

Point Attributes Description
Point Type REAL
Decimal places 2
Maximum value 1.10
Minimum value 0.60

Linear Gauge: Place on the CimEdit Screen.

  1. Open the .NET Component browser.
  2. Place the LinearGauge on the CimEdit screen, as follows.
  3. Select .NET Components>Sample Components>GaugeControls>LinearGauge.
  4. Click OK.

The linear gauge control is placed on the CimEdit screen.

Resize/move the linear gauge to accommodate the display.

Linear Gauge: Apply Basic Control Properties

The linear gauge's basic display properties can be selected in the control's Properties - Object dialog box>Control Properties list.

  1. (Optional) Change the color and/or fonts.
    Note: The linear control also has a BlinkSeconds property that causes a region to blink if the value is in its range. BlinkSecond indicates the number of times the region should blink per second. Blink = 1 per second or higher. No Blink = 0.
  2. Revise some basic values in the control's Properties dialog box>Control Properties list to customize the control for the selected point.

Field Description Example Value
1 MinReading Lowest reading on the gauge. 0.6
2 MaxReading Highest reading on the gauge. 1.1
3 DecimalPlaces Number of decimal places in the value display. 2
4 MajorTicks

Prominent ticks on the gauge.

Note: The value excludes the starting point.

5
5 Range1Color Color for the lowest range on the gauge Yellow
Range1High

Highest value for Range1.

Note: The Range1 color ends at this value.

.75
6 MinorTicks Small ticks going from one major tick to the next. 4
7 Range 2Color Color for the middle range Green
Range2High

Highest value for Range2.

Note: The Range2 color ends at this value.

1
8 Range3Color Color for the highest range. Red.
9 Title Identifies the linear gauge Viscosity

Result: The linear gauge display is ready to report point values (e.g. PROCESS_VISCOSITY). A simple script will pull the data into the gauge; the script will be triggered by an event.

Linear Gauge: Configure an Event and Simple Script

Although the linear gauge has many properties that can be easily configured in the control properties list, an event and script are required to connect a selected point's data to the gauge.

For this control a simple event and script are all that is required:

  1. Select Events in the Linear Gauge control's Properties - Object dialog box.
  2. Open a new Edit Script window for a Periodic event.

A Event Select Periodic.
B Time period

500 Ms

Note: Specifies the period between the time the event's procedure ends and the time it is re-triggered.

C Action
  1. Click the Popup button to the right of the Action field.

  2. Select New Script on the Popup menu.

An Edit Script window opens for the control's periodic event:

  1. Right-click the mouse under Sub OnTimer().
  2. Select ActiveX Properties>Value of>Reading on the extended Popup menu.

CimOleObj.Reading is inserted into the script:

  1. Enter an Equals sign ( =) after CimOleObj.Reading.
  2. Right-click the Edit Script window after the Equals sign.
  3. Select Points>Get on the Popup menu.

A Get Point dialog box opens:

A Enter a point ID (e.g.PROCESS_VISCOSITY) in the Point Id field.
B Click OK.
The script is now ready to be compiled.
Private cimOleObj As Occ_System_Windows_Forms_DataVisualization.IOccChart
Sub OnTimer()
 cimOleObj.Reading = PointGet("PROCESS_VISCOSITY")
End Sub
Compile the script; close the Edit Script window.

Close the linear gauge's Properties - Object dialog box.

Result: The linear gauge is ready to be tested.

Linear Gauge: Runtime Test

If the configuration is correct, the Gauge needle position will report the point value, and the Region the value is in will blink if blinking is enabled.