forked from minetest-mods/xban2
Improve behavior of GUI search field
This commit is contained in:
parent
37cdbf014e
commit
d2cda4f73a
5
gui.lua
5
gui.lua
@ -61,7 +61,8 @@ local function make_fs(name)
|
|||||||
"size[16,12]",
|
"size[16,12]",
|
||||||
"label[0,-.1;Filter]",
|
"label[0,-.1;Filter]",
|
||||||
"field[1.5,0;12.8,1;filter;;"..ESC(filter).."]",
|
"field[1.5,0;12.8,1;filter;;"..ESC(filter).."]",
|
||||||
"button[14,-.3;2,1;search;Search]",
|
"field_close_on_enter[filter;false]",
|
||||||
|
"button[14,-.3;2,1;search_submit;Search]",
|
||||||
}
|
}
|
||||||
local fsn = #fs
|
local fsn = #fs
|
||||||
fsn=fsn+1 fs[fsn] = format("textlist[0,.8;4,9.3;player;%s;%d;0]",
|
fsn=fsn+1 fs[fsn] = format("textlist[0,.8;4,9.3;player;%s;%d;0]",
|
||||||
@ -122,7 +123,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if fields.search then
|
if fields.search_submit or fields.filter then
|
||||||
local filter = fields.filter or ""
|
local filter = fields.filter or ""
|
||||||
state.filter = filter
|
state.filter = filter
|
||||||
state.list = make_list(filter)
|
state.list = make_list(filter)
|
||||||
|
Loading…
Reference in New Issue
Block a user