XScript Manual · 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.
GUI full function reference (XUtilGui)
Sourced from C# — every function callable from script.
Message boxes
| Function | Meaning |
|---|---|
GUI.ShowMessage(buttonType, code, args...) | code-based message dialog. Returns XEventResult |
GUI.ShowMessage(code, args...) / (format, args...) / (buttonType, format, args...) | code or format string |
GUI.ShowTimerMessage(buttonType, code, args...) / (buttonType, msg) / (buttonType, format, args) | auto-close timer |
GUI.ShowMessageStudio(...) / GUI.ShowTimerMessageStudio(...) | Studio (dev tool) variants |
GUI.IsShowMessage() / GUI.HideMessage() | currently shown? / force close |
GUI.SetMessageBoxLayout(width, height, msgFontSize, titleFontSize=0) | message box size/font |
GUI.SetErrorDlgLayout(width, height, msgFontSize, titleFontSize=0) | error dialog variant |
GUI.GetMsg(code) / GUI.GetMsgStudio(code) | message code → text |
GUI.GetErrorMessage(code) | error code → text |
Dialogs / windows
| Function | Meaning |
|---|---|
GUI.ShowDialog(viewModuleName) | modal dialog. OK = true, Cancel = false |
GUI.CloseDialog(viewModuleName, dlgResult) | force close + set result |
GUI.ShowWindow(viewModuleName) | non-modal window |
GUI.SetWindowPos(viewModuleName, left, top, cx, cy) | window position/size |
GUI.CloseWindow(viewModule) / (childControl) | close window |
GUI.AdjustWindowVisibleOnScreen(window) | keep within visible screens |
GUI.GetTopWindow(childControl) | top-level window of a child |
GUI.ShowInitDialog() | initialization dialog (boot flow) |
GUI.ShowManualDialog(messageCode) | manual operation dialog |
JobFile · monitor pages
| Function | Meaning |
|---|---|
GUI.ShowJobFileNewDialog() / ShowJobFileOpenDialog() / ShowJobFileSaveAsDialog() | standard JobFile dialogs |
GUI.ShowMotorMonitor() / GUI.ShowIoMonitor() | motor / IO monitor |
GUI.ShowPage(viewBaseName, pageName, hideConfirm=true) | navigate page |
GUI.ShowRunPage() | go to main run page |
Users / permissions
| Function | Meaning |
|---|---|
GUI.Login(userLevel) / (id, pw) / (id, pw, requiredLevel) | login (3 variants) |
GUI.Logout() | logout |
GUI.ShowUserModify(userLevel) | user-modify dialog |
GUI.SetPageLevel(viewName, userLevelInt) / (viewName, userLevelStr) | per-page access level |
Control properties — modify GUI from script
| Function | Meaning |
|---|---|
GUI.SetControlVisible(module, control, visibleMode) | toggle Visible |
GUI.SetControlVisiblity(module, control, visibility) | 0 ~ 2 (Visible / Hidden / Collapsed) |
GUI.SetControlBoolProperty(module, control, property, onoff) / GetControlBoolProperty(...) | bool property |
GUI.SetControlIntProperty(...) / GetControlIntProperty(...) | int property |
GUI.SetControlStringProperty(...) | string |
GUI.SetControlDoubleProperty(...) | double |
GUI.SetControlBrushProperty(module, control, property, color) | color (#RRGGBB / resource key) |
GUI.SetControlDateTimeProperty(...) | long Ticks |
GUI.InvokeControlMethod(module, control, methodName) | invoke control method |
Monitors / screens
| Function | Meaning |
|---|---|
GUI.GetScreenCount() | monitor count |
GUI.GetMainScreenIndex() | primary monitor index |
GUI.GetScreenWorkArea(idx, ref left, ref top, ref width, ref height) | work area |
Virtual keyboard
| Function | Meaning |
|---|---|
GUI.ShowVirtualKeyboard(control) | show |
GUI.InvokeVirtualKeyboard(control) | force open |
File dialogs
| Function | Meaning |
|---|---|
GUI.ShowOpenFileDialog(initDir, ref defaultFile, fileFilter) | open file |
GUI.ShowSaveFileDialog(initDir, ref defaultFile, fileFilter) | save file |
GUI.ShowFolderSelectDialog(initPath) | folder select |
Localization / Excel I/O
| Function | Meaning |
|---|---|
GUI.ChangeProjectLanguage(lang) / GUI.ChangeProjectLanguageByIndex(idx) | switch language |
GUI.GetCurrentProjectLanguage() / GUI.GetCurrentProjectLanguageIndex() | current language |
GUI.ExportControlLangTextToExcel(path) / GUI.ImportControlLangTextFromExcel(path) | control localization ↔ Excel |
GUI.ExportControlLangTextToExcelByDialog(openFolder) / GUI.ImportLangTextExcelFileByDialog() | dialog variants |
GUI.ExportMessageDataByDialog(openFolder) / GUI.ImportMessageDataByDialog() | message data ↔ Excel |
GUI.ExportErrorDataByDialog(openFolder) / GUI.ImportErrorDataByDialog() | error data ↔ Excel |