mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-01-27 05:19:08 +01:00
textvox
This commit is contained in:
parent
b970cc1f8b
commit
19f3682093
3 changed files with 22 additions and 8 deletions
|
@ -971,10 +971,10 @@ event_inherited();
|
||||||
search_list = ds_list_create();
|
search_list = ds_list_create();
|
||||||
KEYBOARD_RESET
|
KEYBOARD_RESET
|
||||||
|
|
||||||
tb_search = new textBox(TEXTBOX_INPUT.text, function(str) /*=>*/ { search_string = string(str); searchNodes(); });
|
tb_search = new textBox(TEXTBOX_INPUT.text, function(str) /*=>*/ { search_string = string(str); searchNodes(); })
|
||||||
tb_search.align = fa_left;
|
.setAlign(fa_left)
|
||||||
tb_search.auto_update = true;
|
.setAutoupdate();
|
||||||
WIDGET_CURRENT = tb_search;
|
WIDGET_CURRENT = tb_search;
|
||||||
|
|
||||||
function searchNodes() {
|
function searchNodes() {
|
||||||
ds_list_clear(search_list);
|
ds_list_clear(search_list);
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
/// @description init
|
/// @description init
|
||||||
if !ready exit;
|
if !ready exit;
|
||||||
|
|
||||||
#region base UI
|
DIALOG_DRAW_BG
|
||||||
DIALOG_DRAW_BG
|
if(DIALOG_SHOW_FOCUS) DIALOG_DRAW_FOCUS
|
||||||
if(DIALOG_SHOW_FOCUS) DIALOG_DRAW_FOCUS
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region content
|
#region content
|
||||||
WIDGET_CURRENT = tb_search;
|
WIDGET_CURRENT = tb_search;
|
||||||
|
|
|
@ -127,12 +127,14 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static setAlign = function(align) { self.align = align; return self; }
|
||||||
static setHide = function(hide) { self.hide = hide; return self; }
|
static setHide = function(hide) { self.hide = hide; return self; }
|
||||||
static setFont = function(font) { self.font = font; return self; }
|
static setFont = function(font) { self.font = font; return self; }
|
||||||
static setLabel = function(label) { self.label = label; return self; }
|
static setLabel = function(label) { self.label = label; return self; }
|
||||||
static setPrecision = function(precision) { self.precision = precision; return self; }
|
static setPrecision = function(precision) { self.precision = precision; return self; }
|
||||||
static setPadding = function(padding) { self.padding = padding; return self; }
|
static setPadding = function(padding) { self.padding = padding; return self; }
|
||||||
static setEmpty = function() { no_empty = false; 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) {
|
static activate = function(_def_str = _current_text) {
|
||||||
WIDGET_CURRENT = self;
|
WIDGET_CURRENT = self;
|
||||||
|
@ -176,6 +178,13 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
cursor_select = -1;
|
cursor_select = -1;
|
||||||
|
|
||||||
move_cursor(-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) {
|
if(KEYBOARD_PRESSED == vk_right) {
|
||||||
|
@ -186,6 +195,13 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
cursor_select = -1;
|
cursor_select = -1;
|
||||||
|
|
||||||
move_cursor(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++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue