DVX_GUI/widgets/textInput/textinpt.dhs

65 lines
3.1 KiB
Text

.topic widget.textinput
.title TextInput / TextArea
.toc 1 Input Widgets
.toc 1 TextInput / TextArea
.index TextInput
.index TextArea
.index wgtTextInput
.index wgtTextArea
.index wgtPasswordInput
.index wgtMaskedInput
.h2 TextInput / TextArea
Single-line text input, password input, masked input, and multi-line text area with optional syntax colorization, line numbers, find/replace, and gutter decorators.
Header: widgets/widgetTextInput.h
.h3 Creation
.table
Macro Description
----- -----------
wgtTextInput(parent, maxLen) Create a single-line text input. maxLen is the maximum number of characters.
wgtPasswordInput(parent, maxLen) Create a password input (characters displayed as bullets).
wgtMaskedInput(parent, mask) Create a masked input field. The mask string defines the input format.
wgtTextArea(parent, maxLen) Create a multi-line text area.
.endtable
.h3 Methods (TextArea-specific)
.index wgtTextAreaSetColorize
.index wgtTextAreaGoToLine
.index wgtTextAreaSetAutoIndent
.index wgtTextAreaSetShowLineNumbers
.index wgtTextAreaFindNext
.index wgtTextAreaReplaceAll
.table
Macro Description
----- -----------
wgtTextAreaSetColorize(w, fn, ctx) Set a syntax colorization callback. The callback receives each line and fills a color index array. Color indices: 0=default, 1=keyword, 2=string, 3=comment, 4=number, 5=operator, 6=type/builtin, 7=reserved.
wgtTextAreaGoToLine(w, line) Scroll to and place the cursor on the given line number.
wgtTextAreaSetAutoIndent(w, enable) Enable or disable automatic indentation on newline.
wgtTextAreaSetShowLineNumbers(w, show) Show or hide line numbers in the gutter.
wgtTextAreaSetCaptureTabs(w, capture) When true, Tab key inserts a tab/spaces instead of moving focus.
wgtTextAreaSetTabWidth(w, width) Set the tab stop width in characters.
wgtTextAreaSetUseTabChar(w, useChar) When true, insert literal tab characters; when false, insert spaces.
wgtTextAreaFindNext(w, needle, caseSens, fwd) Search for the next occurrence. Returns true if found.
wgtTextAreaReplaceAll(w, needle, repl, caseSens) Replace all occurrences. Returns the number of replacements made.
wgtTextAreaSetLineDecorator(w, fn, ctx) Set a gutter line decorator callback. The callback returns a color and receives the line number, a color output pointer, and the user context.
wgtTextAreaGetCursorLine(w) Get the current cursor line number.
wgtTextAreaSetGutterClick(w, fn) Set a callback for gutter clicks (e.g. for breakpoint toggling). Callback receives the widget and line number.
.endtable
.h3 Events
.table
Callback Description
-------- -----------
onChange Fires when the text content changes.
onKeyPress Fires on each key press (ASCII value).
onValidate Called before committing a change. Return false to cancel.
.endtable
.hr