import{_ as e,a,b as r,ag as o}from"./chunks/framework.BcrMLAmg.js";const u=JSON.parse('{"title":"TextBox","description":"","frontmatter":{},"headers":[],"relativePath":"references/elements/TextBox.md","filePath":"references/elements/TextBox.md","lastUpdated":1757844696000}'),d={name:"references/elements/TextBox.md"};function n(x,t,s,l,i,h){return r(),a("div",null,t[0]||(t[0]=[o('
A multi-line text editor component with cursor support and text manipulation features
Extends: VisualElement
| Property | Type | Default | Description |
|---|---|---|---|
| lines | table | {} | Array of text lines |
| cursorX | number | 1 | Cursor X position |
| cursorY | number | 1 | Cursor Y position (line number) |
| scrollX | number | 0 | Horizontal scroll offset |
| scrollY | number | 0 | Vertical scroll offset |
| editable | boolean | true | Whether text can be edited |
| syntaxPatterns | table | {} | Syntax highlighting patterns |
| cursorColor | number | nil | Color of the cursor |
| Method | Returns | Description |
|---|---|---|
| TextBox:addSyntaxPattern | TextBox | Adds a new syntax highlighting pattern |
| TextBox:removeSyntaxPattern | TextBox | Removes a syntax pattern by index (1-based) |
| TextBox:clearSyntaxPatterns | TextBox | Clears all syntax highlighting patterns |
| TextBox:updateViewport | TextBox | Updates the viewport to keep the cursor in view |
| TextBox:setText | TextBox | Sets the text of the TextBox |
| TextBox:getText | string | Gets the text of the TextBox |
Adds a new syntax highlighting pattern
pattern string The regex pattern to matchcolor number The color to applyTextBox self The TextBox instanceRemoves a syntax pattern by index (1-based)
index number The index of the pattern to removeTextBox selfClears all syntax highlighting patterns
TextBox selfUpdates the viewport to keep the cursor in view
TextBox self The TextBox instanceSets the text of the TextBox
text string The text to setTextBox self The TextBox instanceGets the text of the TextBox
string text The text of the TextBox