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

SignatureDescription
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

SignatureDescription
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
SignatureDescription
bool ShowPage(string viewBaseName, string pageName)Switch page
bool CloseDialog(string viewModuleName, bool dlgResult)Close dialog
void ShowInitDialog(void)System init dialog

Auth

SignatureDescription
bool Logout(void)Log current user out

Globals

PropertyTypeDescription
GlobalBlinkTimerIntervalintBlink interval (ms)

Common-dialog helpers (script-global)

FunctionDescription
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.