Advanced Scripting: Accessing Composite Controls

Advanced Scripting: Accessing Composite Controls

Some advanced objects in Wise SCADA (AlarmView, EventView, RecipeManager, TagMonitor, UserManager, H/VScrollBarCustom, ProgressBarCustom) have a Composite structure. This means these objects are essentially “Packages” that contain multiple standard controls (Buttons, Grids, TextBoxes, etc.) within them.
You can access these internal controls via script to make changes that are not available in the standard properties panel (e.g., changing the color of the “Acknowledge” button on the Alarm page or modifying its click event).

Method for Accessing Internal Controls

Every composite object maintains its internal components within a collection (Controls). You can access the relevant component via its “Name”.
General Syntax: MainObject.Controls[“InternalObjectName”]
Example Scenario: Accessing the AckButton (Acknowledge Button) component inside the AlarmView_0 object and changing its color.

C#
// 1. Find the button inside and assign it to a variable
// Note: If you know the type (Button, DataGridView, etc.), cast it directly to that type.
Button ackButton = (Button)AlarmView_0.Controls["AckButton"];
// 2. You can now change the properties of this button
ackButton.BackColor = Color.Red; // Change the color to red
ackButton.Text = "Acknowledge Error"; // Change the text

Customizing and Overriding Events

This method is used not only for visual changes but also to modify the behavior of objects.
For example, when a button is pressed, you can execute your own custom code in addition to its standard function, or you can cancel the standard function entirely.
Note: The process of “Event Override” and preventing the execution of an existing function is a sensitive topic within the C# event structure and requires careful implementation.

Leave a Reply