Win Object Methods
Methods available on the UI script win object and widgetWindow instances in Novadesk.
Novadesk enforces a Strict Separation of Concerns between the Main script (application logic) and UI scripts (visual presentation).
INFO
- Main Script: Manages widget windows (creation, positioning, lifecycle). It cannot directly add UI elements.
- UI Script: Manages visual elements (text, images, interactions). It cannot directly change window-level properties.
- Communication: Use the global ipc object to communicate between these contexts.
Table of Contents
UI Element Methods
INFO
The following methods are only available inside a UI script via the win object.
ui.addText(options)
Creates a text element inside the UI script.
options- Type:
Object - Description: Text element configuration. Requires a unique
id.
- Type:
Refer to addText Options for full configuration details.
ui.addImage(options)
Adds an image element.
options- Type:
Object - Description: Image element configuration. Requires a unique
id.
- Type:
Refer to addImage Options.
ui.addBar(options)
Adds a bar element.
options- Type:
Object - Description: Bar element configuration. Requires a unique
id.
- Type:
Refer to addBar Options.
ui.addRoundLine(options)
Adds a roundline element.
options- Type:
Object - Description: RoundLine configuration. Requires a unique
id.
- Type:
See addRoundLine Options.
ui.addShape(options)
Adds a shape element.
options- Type:
Object - Description: Shape configuration. Requires a unique
id.
- Type:
Refer to addShape Options.
ui.setElementProperties(id, props)
Updates a single element.
id(string): Element identifier.props(Object): Properties to change.
Example
ui.setElementProperties("myText", { x: 20, y: 20 });ui.setElementPropertiesByGroup(group, props)
Updates every element sharing a group.
group(string): Group name.props(Object): Properties to apply.
Example
ui.setElementPropertiesByGroup("stats", { show: false });ui.removeElements(ids)
Removes one or more elements.
ids- Can be a single
string, anArrayof IDs, ornull/undefinedto clear all elements.
- Can be a single
WARNING
Calling removeElements() with no arguments removes all elements from the widget.
Example
ui.removeElements(["img1", "text3"]);
ui.removeElements(); // Clears everythingui.removeElementsByGroup(group)
Removes all elements in a group.
group(string): Group name to clear.
Example
ui.removeElementsByGroup("stats");ui.getElementProperty(id, propertyName)
Reads a property value.
id(string): Element identifier.propertyName(string): Name of the property.
Return Value
- Type:
any | null | undefined - Description: Returns
nullif the element is missing;undefinedif the property does not exist.
Example
var textValue = ui.getElementProperty("myText", "text");ui.beginUpdate()
Begins a batch UI update. Redraws remain deferred until ui.endUpdate() is called.
ui.endUpdate()
Ends the batch and forces a redraw.