InputBox Addon
The InputBox addon shows a lightweight input overlay window and returns user interaction through callbacks.
Table of Contents
Quick Start
javascript
import { addon, widgetWindow } from "novadesk";
const inputBox = addon.load("D:/Novadesk-Project/InputBox/dist/x64/Debug/InputBox.dll");
const id = inputBox.show({
widgetHwnd: widgetWindow.getHandle(),
x: 16,
y: 16,
width: 320,
defaultValue: "Type here...",
onEnter: () => {
console.log("Submitted:", inputBox.lastText());
}
});
console.log("InputBox id:", id);Exported Functions
show(optionsOrDefaultValue)
Opens an input box and returns numeric id.open(optionsOrDefaultValue)
Alias ofshow(...).close(id)
Closes a specific input box id. Returnstruewhen closed, otherwisefalse.closeAll()
Closes all open InputBox windows. Returnstrue.lastText()
Returns the latest event text as string.lastReason()
Returns latest event reason code as number.lastId()
Returns the input box id that produced the latest event.
show(optionsOrDefaultValue)
Parameter Forms
string: sets initial text (defaultValue).object: full options object.
If the argument is neither string nor object, the addon throws:
InputBox.show(options) expects object|string.
Return Value
- Type:
number - Description: InputBox instance id. Returns
0if create fails.
Options
Position and Size
x(number, default100)y(number, default100)widthorw(number, default300, clamped120..1200)heightorh(number, default40, clamped28..800)widgetHwndorhwnd(number, optional)
If provided,x/yare treated as offsets from that window.
Behavior
topMost(boolean, defaulttrue)unfocusDismiss(boolean, defaulttrue)
Close on losing focus.multiline(boolean, defaultfalse)password(boolean, defaultfalse)
Ifpasswordandmultilineare both true, multiline is disabled.allowScroll(boolean, defaultfalse)
Enables vertical scroll when multiline.maxLength(number, default0, clamped0..32766)
Input Validation
inputType(string, default"Any")
Supported values:AnyInteger/IntFloat/NumberLettersAlphanumericHex/HexadecimalEmailCustom
allowedChars(string, used wheninputType: "Custom")minValue(number, optional; enables numeric range checks)maxValue(number, optional; enables numeric range checks)
Text and Styling
defaultValue(string, optional)fontFace(string, default"Segoe UI")fontSize(number, default14, clamped8..72)bold(boolean, defaultfalse)italic(boolean, defaultfalse)align(string, default"LEFT")
Supported:LEFT,CENTER,RIGHTborderVisible(boolean, defaulttrue)borderThickness(number, default1, clamped0..12)fontColorortextColor(string)backgroundColororbgColor(string)borderColor(string)
Color strings are parsed via Novadesk color parser (rgb(...), rgba(...), hex formats, etc.).
Callbacks
All callbacks are optional and receive no function arguments. Use lastText(), lastReason(), and lastId() to inspect latest event data.
onEnter
Fired when Enter submits valid input.onEsc
Fired when Esc is pressed.onDismiss
Fired when box is dismissed (blur/close path).onInvalid
Fired when invalid character or invalid final value is submitted.onChange
Fired on edit updates.
Event Reason Codes
0: None1: Enter2: Esc3: Dismiss4: Invalid5: Change
Keyboard Behavior
Esccloses with reasonEsc.Entersubmits with reasonEnter.- In multiline mode,
Entersubmits only whenCtrl+Enteris pressed.
Examples
Integer Input with Range
javascript
import { addon } from "novadesk";
const inputBox = addon.load("D:/Novadesk-Project/InputBox/dist/x64/Debug/InputBox.dll");
inputBox.show({
defaultValue: "50",
inputType: "Integer",
minValue: 0,
maxValue: 100,
onEnter: () => console.log("Value:", inputBox.lastText()),
onInvalid: () => console.log("Invalid:", inputBox.lastText())
});Custom Character Set
javascript
import { addon } from "novadesk";
const inputBox = addon.load("D:/Novadesk-Project/InputBox/dist/x64/Debug/InputBox.dll");
inputBox.show({
defaultValue: "FFAA00",
inputType: "Custom",
allowedChars: "0123456789ABCDEFabcdef"
});