feat: 'edited' property reset & add 'oncontrolkey' textbox callback

This commit is contained in:
MihailRis
2025-03-12 19:51:22 +03:00
parent fb18442322
commit 3a4b334d0b
14 changed files with 88 additions and 5 deletions
+3 -1
View File
@@ -79,7 +79,7 @@ Properties:
| hint | string | yes | yes | text to display when nothing is entered |
| caret | int | yes | yes | carriage position. `textbox.caret = -1` will set the position to the end of the text |
| editable | bool | yes | yes | text mutability |
| edited | bool | yes | no | is text edited since the last set (history is not empty) |
| edited | bool | yes | yes\* | is text edited since the last set / edited status reset |
| multiline | bool | yes | yes | multiline support |
| lineNumbers | bool | yes | yes | display line numbers |
| textWrap | bool | yes | yes | automatic text wrapping (only with multiline: "true") |
@@ -88,6 +88,8 @@ Properties:
| syntax | string | yes | yes | syntax highlighting ("lua" - Lua) |
| markup | string | yes | yes | text markup language ("md" - Markdown) |
\* - false only
Methods:
| Method | Description |
+2
View File
@@ -110,6 +110,8 @@ Inner text - initially entered text
- `supplier` - text supplier (called every frame)
- `consumer` - lua function that receives the entered text. Called only when input is complete
- `sub-consumer` - lua function-receiver of the input text. Called during text input or deletion.
- `oncontrolkey` - lua function called for combinations of the form (Ctrl + ?). The codepoint of the second key is given as the first argument.
The key code for comparison can be obtained via `input.keycode("key_name")`
- `autoresize` - automatic change of element size (default - false). Does not affect font size.
- `multiline` - allows display of multiline text.
- `text-wrap` - allows automatic text wrapping (works only with multiline: "true")
+3 -1
View File
@@ -79,7 +79,7 @@ document["worlds-panel"]:clear()
| hint | string | да | да | текст, отображаемый, когда ничего не введено |
| caret | int | да | да | позиция каретки. `textbox.caret = -1` установит позицию в конец текста |
| editable | bool | да | да | изменяемость текста |
| edited | bool | да | нет | был ли изменён текст с последней установки (история не пуста) |
| edited | bool | да | да\* | был ли изменён текст с последней установки/сброса свойства |
| multiline | bool | да | да | поддержка многострочности |
| lineNumbers | bool | да | да | отображение номеров строк |
| textWrap | bool | да | да | автоматический перенос текста (только при multiline: "true") |
@@ -88,6 +88,8 @@ document["worlds-panel"]:clear()
| syntax | string | да | да | подсветка синтаксиса ("lua" - Lua) |
| markup | string | да | да | язык разметки текста ("md" - Markdown) |
\* - только false
Методы:
| Метод | Описание |
+2
View File
@@ -111,6 +111,8 @@
- `supplier` - поставщик текста (вызывается каждый кадр)
- `consumer` - lua функция-приемник введенного текста. Вызывается только при завершении ввода
- `sub-consumer` - lua функция-приемник вводимого текста. Вызывается во время ввода или удаления текста.
- `oncontrolkey` - lua функция вызываемая для сочетаний вида (Ctrl + ?). На вход подаётся числовой код второй клавиши.
Код клавиши для сравнения можно получить через `input.keycode("имя_клавиши")`
- `autoresize` - автоматическое изменение размера элемента (по-умолчанию - false). Не влияет на размер шрифта.
- `multiline` - разрешает отображение многострочного текста.
- `text-wrap` - разрешает автоматический перенос текста (работает только при multiline: "true")