Frequently Asked Questions

<< Click to Display Table of Contents >>

 

Frequently Asked Questions

How to open a windowed Screen that displays a title bar with minimize, maximize, and close buttons?

To do so, users must use Splitter's SetFrameOptions method. The Flags parameter specifies features for this window. A value of 127 defines a window with visible Minimize, Maximize, and Close buttons.

 

How to open a modal Screen?

To open a modal Screen, use Viewer's DoModal method, according to the next example.

Application.DoModal "Screen1", "Title1", 0, 0, 400, 200, 0, 1

 

This code opens a Screen named "Screen1", with title "Title1", at position (0, 0), with a width of 400 pixels and a height of 200 pixels, passes 0 (zero) as a Screen parameter, and enables a window's title bar.

 

How to copy values from an E3Browser's row to a Tag?

First, select the row (or record) on an E3Browser. Then, use E3Browser's GetColumnValue method. The Index parameter is the column's index to copy (starting at zero).

 

How to prevent users from typing a String in a SetPoint?

Check if the typed value is a number on SetPoint's Validate event, according to the next example.

Sub Text1_Validate(Cancel, NewValue)
  If NOT IsNumeric(newValue) Then
    MsgBox "This value must be a number."
    Cancel = True
  End If
End Sub

 

How to open a date picker to select a date and a time when clicking a SetPoint?

By using the ShowDatePicker method on SetPoint's Click event, according to the next example.

Sub Text1_Click()
  Dim datevalue
  If Application.ShowDatePicker(datevalue) Then
    Value = datevalue
  End If
End Sub

 

How to acknowledge all alarms of an Area?

To acknowledge all alarms of an Area by script, users can use the AckArea method. This method has two parameters, as follows:

Area is the name of the Alarm Area that that users want to acknowledge an alarm

User is the name of the logged-on operator, which can be the Application.User item

 

To acknowledge all active alarms, users can also use the AckAllAlarms method.

 

How to execute an action when clicking a specific mouse button or a key?

By using Screen's KeyDown or KeyUp events. These events are triggered when a key is pressed or released and return two parameters. One is the code of the pressed key, and the other one is the SHIFT and CTRL key status when this key was pressed. The idea is to compare event's returned parameters with the code of the expected character.

 

How to create a WhileRunning script?

By creating an event linked to a property that always has the same value. For example, the Visible property of a Screen object. While this object is visible (its Visible property set to True), this script is executed. However, it is recommended to avoid using WhileRunning scripts, because they may affect application's performance. In most cases, they can be replaced by Links.

 

How to create an OnValueChanged script?

By creating an event linked to a Tag's Value property, which is executed when this property changes its value.

 

NOTE

Be careful when using Viewer methods on Server, such as the MsgBox method. If this is the case, this event can be created on Screen or even on Viewer object, instead of creating it on a Tag.

 

How to create Tags and Screen objects at run time?

By using the AddObject method. For example, the following script creates I/O Tags on Driver1 Driver.

Set obj = Application.GetObject("Driver1")
For i = 1 To 100
  Set tag = obj.AddObject("IOTag", false)
  tag.Name = "IOTag" & CStr(i)
  tag.Activate
Next

 

How to display a message on Screen when changing a Tag's value?

By creating an event on the Screen linked to Tag's Value property, which is executed when this property changes its value. On this event, use the MsgBox method to display that message.

 

How to create a Query with a filter by date before assembling a Report?

To do so, users must configure the Query object (please check the Query chapter) that accompanies a Report and then create the necessary variables on the Filter column. On the event that opens this Report, use a script similar to the next one.

Set report = Application.LoadReport("[Report1]")
Set query = report.Query()
query.SetVariableValue "Variable1", Value1
query.SetVariableValue "Variable2", Value2
report.PrintPreview()

 

Where:

[Report1] is the name of the Report to open

Variable1 and Variable2 are variables created on E3TimeStamp field's filter

Value1 and Value2 are dates to query

 

To check other types of filters, please check the Query chapter or the available documentation on Elipse Knowledgebase.

 

How to debug script errors on an Elipse E3 Viewer and on a server?

If an event is executing on an Elipse E3 Viewer, use Viewer's Trace method. If an event is executing on a server, use server's Trace method.

Was this page useful?