XScript Manual · Chapter 32
title: "GUI — view & control manipulation" chapter: 32
GUI — view & control manipulation
GUI is the script-side handle for manipulating views and controls — page
navigation, dialogs, property changes (Visible / Enabled / Text / Color), and
auth state.
Real-world example
// Reflect start/stop state
GUI.SetControlBoolProperty("ViewRun", "btnStart", "IsDown", ON);
GUI.SetControlBoolProperty("ViewRun", "btnStop", "IsDown", OFF);
// Toggle visibility
GUI.SetControlVisible("ViewSetup", "tbTimeout", true);
GUI.SetControlVisible("ViewSetup", "pnlSwingOption", false);
// Color (check contrast in both dark & light themes)
GUI.SetControlBrushProperty("ViewMain", "lblUnitConnect", "Foreground", "#FFFF0000");
// Navigate
GUI.ShowPage("BasePanel", "ViewOrder");
// Init dialog
GUI.ShowInitDialog();
// Close a dialog
GUI.CloseDialog("DlgOrderCancel", true);
// Logout
GUI.Logout();Key methods
Visibility / enable
| Signature | Description |
|---|---|
bool SetControlVisible(string moduleName, string controlName, int visibleMode) | 0 Visible, 1 Hidden, 2 Collapsed |
bool SetControlVisible(string moduleName, string controlName, bool visible) | Bool shortcut |
bool SetControlVisiblity(string moduleName, string controlName, int visibility) | Uses Visibility_* constants |
bool SetControlBoolProperty(string moduleName, string controlName, string propertyName, bool onoff) | Any bool property |
Text / value
| Signature | Description |
|---|---|
bool SetControlStringProperty(string moduleName, string controlName, string propertyName, string value) | String property |
bool SetControlDoubleProperty(string moduleName, string controlName, string propertyName, double value) | Double property |
bool SetControlIntProperty(string moduleName, string controlName, string propertyName, int value) | Int property |
bool SetControlBrushProperty(string moduleName, string controlName, string propertyName, string color) | Brush |
Navigation / dialog
| Signature | Description |
|---|---|
bool ShowPage(string viewBaseName, string pageName) | Switch page |
bool CloseDialog(string viewModuleName, bool dlgResult) | Close dialog |
void ShowInitDialog(void) | System init dialog |
Auth
| Signature | Description |
|---|---|
bool Logout(void) | Log current user out |
Globals
| Property | Type | Description |
|---|---|---|
GlobalBlinkTimerInterval | int | Blink interval (ms) |
Common-dialog helpers (script-global)
| Function | Description |
|---|---|
ShowMessage(button, messageCode) / ShowMessage(button, text) | Confirm dialog |
ShowError(button, errorCode, subMsg) | Error dialog |
ShowTimerMessage(button, messageCode) | Auto-dismissing message |
Button constants: EB_Ok, EB_YesNo, EB_OkCancel, EB_RetrySkip, EB_Reset, …
if (ShowMessage(EB_YesNo, 210) == ER_No)
{
return false;
}
ShowError(EB_Reset, 1201, $"{unitName} > Sens:{cnvSensorName}");
ShowTimerMessage(EB_Ok, 215);Tips
- Message codes are managed in the Message Editor — scripts reference them by number only.
- For colors, prefer theme resource references; hardcoded hex values can disappear when the theme switches.
- During long threads, update UI via bindings rather than touching controls directly.