Skip to content
Menu
Menu

Knowledge Base

KB050082 | REMEMBERING STATES IN THE EVENT PROCESSING OF THE OPERATOR STATION

KB050082 | REMEMBERING STATES IN THE EVENT PROCESSING OF THE OPERATOR STATION

Product: Elvis
Version: 2.3
Booth: 2005-04-06

Summary

Sometimes you want to keep certain states within the event processing of the operator station in order to be able to use them later in other events. Examples:

  • Composing a value from different events (e.g. entering numbers on a “numeric keypad”)
  • Caching of elaborately calculated values

This article discusses several ways to store such states.

Details

Option 1: Data Point Property

From event processing, you can use Database.Datapoint(name). property can access data point properties and remember states there.

Attention: If several operator stations are active at the same time, they all use the same value with this solution! Whether this is desirable depends on the application, usually this is not the case.

This method also remembers values beyond the lifetime of the page, depending on the “persistence” of the data point also beyond the runtime of the server.

Example:

//CODE:vb:Sub MyButton_Click()
 Database.Datapoint("Page5_State").ActualValue = 1
End Sub//CODE
Option 2: Control Element Property

From event processing, you can use <tt>form.Name. property</tt> to access control properties and remember states there. The control element can be an element that is already present on the page, or it can be a control element inserted specifically for this purpose (possibly hidden). The possible properties depend on the type of control element, a list can be found in the Elvis Planner Manual in the chapter Operator Station Objects, subchapter Control Element.

The controls (and their properties) exist separately for each page and as long as the page is rendered, therefore different pages do not affect each other.

To hide a control, add the following line to Form_Load:

Form.name.Visible = False
Form.name.Enabled = False

Examples:

//CODE:vb:Sub Button1_Click()
 Form.TextOutput1.Caption = Form.TextOutput1.Caption & "1"
End Sub//CODE
//CODE:vb:Sub Button2_Click()
 Form.AnalogInput1.Value = CInt(Form.AnalogInput1.Tag)
End Sub//CODE
Option 3: Variable under (global)

In event processing, global variables can be defined for each page. These can be used within event processing. However, these variables only retain their values while an event (Form_Load, Form_Unload, Form_DatapointChanged, control_event) is being processed, so they are rather unusable for this purpose.

Option 4: Registry

It is quite easy to save the state in a value in the registry, for this purpose the built-in functions SetPersistentValue/GetPersistentValue are available (see help function for Elvis configuration).

If several operator stations are active on the same computer at the same time, they all use the same value with this solution! However, this should not be a problem in practice.

Example:

//CODE:vb:Sub ButtonCount_Click()
 Dim count As Integer
 count = GetPersistentValue("Page5", "Count", 0)
 SetPersistentValue "Page5", "Count", count+1
End Sub//CODE

Support Area

KB050082 | REMEMBERING STATES IN THE EVENT PROCESSING OF THE OPERATOR STATION

Knowledge Base

Here you will find answers, solutions to problems and examples of our products.
KB050082 | REMEMBERING STATES IN THE EVENT PROCESSING OF THE OPERATOR STATION

Case Studies

Successful in use: practical examples of our products and individual developments.
KB050082 | REMEMBERING STATES IN THE EVENT PROCESSING OF THE OPERATOR STATION

Support

Describe your concern using our support form.
KB050082 | REMEMBERING STATES IN THE EVENT PROCESSING OF THE OPERATOR STATION

License registration

Register your Elvis license!

IT GmbH · An der Kaufleite 12 · D-90562 Kalchreuth

© Copyright 2024. IT GmbH | Webdesign by Appear Online