Skip to main content

GUI

Host.GUI provides command execution, dialog management, clipboard, theme, desktop window, and help tutorial services.

Properties

PropertyTypeWritableExampleDescription
ClipboardobjectNoHost.GUI.Clipboard.setText(text)Text clipboard read/write
CommandsobjectNoHost.GUI.Commands.interpretCommand(...)Command execution, discovery, and management
ConstantsobjectNoHost.GUI.Constants.kYesMouse button, modifier, dialog, and alert constants
DesktopobjectNoHost.GUI.Desktop.closeTopModal()Desktop window and modal management
HelpobjectNoHost.GUI.Help.showLocation("Console")Reference manual navigation and UI focus effects
ThemesobjectNoHost.GUI.Themes.getTheme(pkgID)Theme/skin retrieval for dialogs

Methods

MethodReturnsParametersDescription
Host.GUI.alert(msg)msg — any value (auto-stringified)Show a modal alert dialog
Host.GUI.ask(msg)msg — question stringShow a Yes/No dialog; compare result to Host.GUI.Constants.kYes
Host.GUI.keyStateToString(mask)stringmask — modifier key bitmaskFormat modifier keys for display (e.g. "Command+Shift")
Host.GUI.openUrl(url)urlHost.Url pathOpen a local file or URL in the host
Host.GUI.runDialog(theme, formName, controller)theme — theme object, formName — form name, controller — controller objectOpen a skin.xml dialog (blocking)
Host.GUI.runDialogWithParameters(params, title)params — param list, title — dialog titleOpen a parameter dialog with a param list
Host.GUI.showFile(url)urlHost.Url pathReveal a file in the host

Clipboard

Host.GUI.Clipboard provides simple text clipboard access.

MethodReturnsParametersDescription
Host.GUI.Clipboard.getText()stringnoneGet clipboard text
Host.GUI.Clipboard.setText(text)text — string to copySet clipboard text

Commands

Host.GUI.Commands provides command execution, deferred execution, and command discovery helpers.

MethodReturnsParametersDescription
Host.GUI.Commands.assignKey(command, key)command — command object, key — key stringAssign a keyboard shortcut to a command
Host.GUI.Commands.beginTransaction(title)title — transaction labelStart a command transaction for batching
Host.GUI.Commands.deferCommand(category, name)category — command category, name — command nameDefer a host command for sequenced execution
Host.GUI.Commands.endTransaction()noneEnd a command transaction
Host.GUI.Commands.findCommand(cat, name)objectcat — category, name — command nameFind a command object (.name, .classID)
Host.GUI.Commands.interpretCommand(category, name)category — command category, name — command nameExecute a host command
Host.GUI.Commands.interpretCommand(category, name, clearSelection, attrs)clearSelection — 0/1, attrsHost.Attributes(...) objectExecute with optional selection clear and attributes
Host.GUI.Commands.lookupBindings(command)objectcommand — command objectLook up keyboard bindings for a command
Host.GUI.Commands.lookupKeyEvent(command)command — command objectLook up the key event for a command
Host.GUI.Commands.newCategoryIterator()objectnoneCreate iterator over all categories
Host.GUI.Commands.newCommandIterator()objectnoneCreate iterator over all commands
Host.GUI.Commands.registerCommand(category, name, group, title, englishName)category — category, name — command name, group — group name, title — display title, englishName — English nameRegister a new command
Host.GUI.Commands.unregisterCommand(category, name)category — command category, name — command nameUnregister a previously registered command

See Command Reference for full command reference.

findCommand(category, name) returns a command object with at least classID and name. The resolved classID can be passed back into interpretCommand(...).

Attribute Example:

var attrs = Host.Attributes([
"Length", "0.02",
"Type", "Linear",
"Bend", "0"
]);

Host.GUI.Commands.interpretCommand("Audio", "Create Crossfades", false, attrs);

Create Crossfades accepts Length, Type, and Bend attributes.

Constants

Host.GUI.Constants provides modifier key constants and dialog result codes. Modifier key values are bitwise constants — combine with | (e.g. kShift | kCommand = 24). Compound masks produce joined names in keyStateToString (e.g. "Command+Shift").

ConstantValueCategory
kShift8Modifier key
kCommand16Modifier key
kOption32Modifier key
kControl64Modifier key
kCancel0Dialog result
kOkay1Dialog result
kClose2Dialog result
kApply3Dialog result
kYes0Alert result
kNo1Alert result
kAlertCancel2Alert result
kOk3Alert result
kRetry4Alert result

Desktop

Host.GUI.Desktop provides desktop window and modal management.

MethodReturnsParametersDescription
Host.GUI.Desktop.closeModalWindows()noneClose all open modal dialogs
Host.GUI.Desktop.closeTopModal()noneClose the topmost modal dialog
Host.GUI.Desktop.getApplicationWindow()objectnoneGet the application window object

Help

Host.GUI.Help provides window dimming and UI control highlighting for focus effects. HelpIDs can reference both native UI elements and custom controls in third-party dialogs (via <HelpAnchor helpid="..."> or <Form helpid="..."> in skin.xml).

MethodReturnsParametersDescription
Host.GUI.Help.dimAllWindows()noneDim background windows
Host.GUI.Help.discardHighlights()noneRemove all active highlights and restore dimmed windows
Host.GUI.Help.highlightControl(helpID)helpID — control identifier stringHighlight a UI control by its HelpID (e.g. "Console", "Arrangement", "Inspector")
Host.GUI.Help.modifyHighlights()none
Host.GUI.Help.showLocation()noneOpen the Studio Pro Reference Manual

helpID:

Controls are referenced by helpID string constants. See HelpID for the full list of recognized constants.

Custom helpID:

Custom helpID's can be defined in third-party skin.xml files via <HelpAnchor helpid="..."> wrapping a control or <Form helpid="..."> on a form for the entire dialog window. Use with highlightControl() to highlight the specified control while the display is dimmed.

Themes

Host.GUI.Themes provides theme retrieval for dialog rendering and skin resource access. The returned theme object is passed to Host.GUI.runDialog().

MethodReturnsParametersDescription
Host.GUI.Themes.getTheme(packageID)objectpackageIDPackage:ID from metainfo.xmlGet a theme object for a package's skin
Host.GUI.Themes.loadTheme(packageID)objectpackageID — package identifier stringLoad a theme object

Theme object:

MethodReturnsParametersDescription
theme.getImage(name)objectname — image resource nameGet a named image from the skin's resources

Example:

var theme = Host.GUI.Themes.getTheme(kPackageID);
Host.GUI.runDialog(theme, "MyForm", this);

alert

Host.GUI.alert() provides a modal alert dialog.

Host.GUI.alert(msg)   // Auto-stringifies any value

ask

Host.GUI.ask() provides a Yes/No modal dialog.

var result = Host.GUI.ask(msg);
if (result === Host.GUI.Constants.kYes) { /* yes */ }

keyStateToString

Host.GUI.keyStateToString() formats modifier-key masks for display. Compound masks produce joined names (e.g. "Command+Shift"). Modifier key values are defined in Host.GUI.Constants.

// Modifier key values: kShift=8, kCommand=16, kOption=32, kControl=64
Host.GUI.keyStateToString(8) // "Shift"
Host.GUI.keyStateToString(24) // "Command+Shift"
Host.GUI.keyStateToString(255) // "Command+Shift+Option+Control"

openUrl

Host.GUI.openUrl() opens a local file or URL in the host. Accepts a Host.Url object.

var targetPath = Host.Url("local://$USERCONTENT/your-file.txt");
Host.GUI.openUrl(targetPath);

runDialog

Host.GUI.runDialog() opens a skin.xml dialog (blocking). Requires Package:SkinFile in metainfo.xml.

var theme = Host.GUI.Themes.getTheme(packageID);
var result = Host.GUI.runDialog(theme, "FormName", controller);

runDialogWithParameters

Host.GUI.runDialogWithParameters() opens a parameter dialog with a CCL:ParamList object. Returns a dialog result constant.

var params = Host.Classes.createInstance("CCL:ParamList");
var result = Host.GUI.runDialogWithParameters(params, "Dialog Title");

showFile

Host.GUI.showFile() reveals a file in the host or system file browser. Accepts a Host.Url object.

var path = Host.Url("local://$USERCONTENT/folder/");
Host.GUI.showFile(path);