This commit is contained in:
Tanasart 2025-01-03 10:11:13 +07:00
parent b970cc1f8b
commit 19f3682093
3 changed files with 22 additions and 8 deletions

View file

@ -971,10 +971,10 @@ event_inherited();
search_list = ds_list_create();
KEYBOARD_RESET
tb_search = new textBox(TEXTBOX_INPUT.text, function(str) /*=>*/ { search_string = string(str); searchNodes(); });
tb_search.align = fa_left;
tb_search.auto_update = true;
WIDGET_CURRENT = tb_search;
tb_search = new textBox(TEXTBOX_INPUT.text, function(str) /*=>*/ { search_string = string(str); searchNodes(); })
.setAlign(fa_left)
.setAutoupdate();
WIDGET_CURRENT = tb_search;
function searchNodes() {
ds_list_clear(search_list);

View file

@ -1,10 +1,8 @@
/// @description init
if !ready exit;
#region base UI
DIALOG_DRAW_BG
if(DIALOG_SHOW_FOCUS) DIALOG_DRAW_FOCUS
#endregion
DIALOG_DRAW_BG
if(DIALOG_SHOW_FOCUS) DIALOG_DRAW_FOCUS
#region content
WIDGET_CURRENT = tb_search;

View file

@ -127,12 +127,14 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
return self;
}
static setAlign = function(align) { self.align = align; return self; }
static setHide = function(hide) { self.hide = hide; return self; }
static setFont = function(font) { self.font = font; return self; }
static setLabel = function(label) { self.label = label; return self; }
static setPrecision = function(precision) { self.precision = precision; return self; }
static setPadding = function(padding) { self.padding = padding; return self; }
static setEmpty = function() { no_empty = false; return self; }
static setAutoupdate = function() { auto_update = true; return self; }
static activate = function(_def_str = _current_text) {
WIDGET_CURRENT = self;
@ -176,6 +178,13 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
cursor_select = -1;
move_cursor(-1);
if(key_mod_press(CTRL)) {
while(cursor > 0) {
var ch = string_char_at(_input_text, cursor);
if(breakCharacter(ch)) break;
cursor--;
}
}
}
if(KEYBOARD_PRESSED == vk_right) {
@ -186,6 +195,13 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
cursor_select = -1;
move_cursor(1);
if(key_mod_press(CTRL)) {
while(cursor < string_length(_input_text)) {
var ch = string_char_at(_input_text, cursor);
if(breakCharacter(ch)) break;
cursor++;
}
}
}
}