Loading...
The Group Event Listener device in the Configuration dialog allows you to listen to an event of select group members of the same type, which happens in a group of the configuration tab.
Note that this device is only available in the licensed Widget Designer edition, not the Free version.
To add a Group Event Listener device, open the Devices menu and select "Group Event Listener > Create Group Event Listener". This will open the Configuration dialog. Alternatively, you can add a new device in the Configuration dialog with the "+" button when the dialog is already open. You can also add multiple new Group Event Listener devices by using the "++" button.
On the right side, you see several options:
The Type informs you about the type of device or connection.
The Groups lists the groups to which this device belongs.
The Name is the unique identifier for this Group Event Listener object in WD and the general rules for naming objects apply here as well: only letters, numbers and underscores are allowed; the first symbol must be a letter. It is possible to change the default name to a more descriptive one. When scripting, enter this Name to access available members or use the Project object and device Type instead. See "How to Use Group Event Listener in Regular Scripting" below for examples.
The Id offers an alternative way to address the device when scripting.
The "Enable" check box is selected by default. On the left side, you should later see that the icon in front of your Group Event Listener device is a filled blue circle. An empty blue circle indicates an enabled device where the IP address is not available. A filled grey circle indicates a disabled device.
The "Group" drop-down lists all available groups that can be selected to monitor a specific type of device that must be present in that group.
The type of devices, which are inside this selected group, are listed in the "Device" drop-down list. Choose one, and the "Event" drop-down will offer all events referring to that device.
The "Event" specifies the trigger, i.e. when to execute the following script. Select one from the drop-down list.
The scripting field can be filled with commands that should be executed when the event happens. For example, you could write the following: Label1.Text = "yourMessage"
Some events offer "Parameters". When choosing the event "InputLabelChanged" from the device VideoHub1, for example, you will see that it lists some parameter names on top of the scripting field, such as "Input (Integer)" and "Label (String)". This means that this specific event provides these values as local variables to be used in the script. For instance, you can write "Label1.Text = Label" and the Label will instantly show the name of the changed input label which was just applied, whenever this occurs.
As soon as a device is created, it can be addressed via scripting to perform actions on the device as well as retrieve information from it.
To send commands to the device, create a CustomScript button or anything with a scripting field. Enter the device's identifier name into the script field (by default that is "GroupEventListener1") and Script Assist will offer a list of all GroupEventListener Members.
For example, you can enable the Group Event Listener:
GroupEventListener1.Enable
You can also retrieve information via scripting:
Label1.Text = GroupEventListener1.IsEnabled
This fills Label1 with the text "True".
As an alternative to explicitly naming the device, the "Project" object can be used. Choose the device type and address of the device by entering its ID or name. Script Assist then offers you the same list of members. This is the alternative for the first example from above:
Label1.Text = Project.GroupEventListener(1).IsEnabled
Substituting the ID with a dynamic variable allows automation. Actions can be performed on many connections of the same type simultaneously, e.g. by using for-loops:
For i = 1 to 5
{
Project.GroupEventListener(i).Disable
}
The chapter "Project and Context Member" shows more examples with for-loops and if-clauses; normal variables can also be used.