add a clear button to the market search field
This commit is contained in:
parent
a909d73a9a
commit
3984b625a9
@ -298,11 +298,13 @@ local get_market_formspec = function(market, account)
|
|||||||
-- search field
|
-- search field
|
||||||
formspec[#formspec+1] = "container[2.5,5]field_close_on_enter[search_filter;false]"
|
formspec[#formspec+1] = "container[2.5,5]field_close_on_enter[search_filter;false]"
|
||||||
.."field[0,0.85;2.5,1;search_filter;;"..minetest.formspec_escape(account.search or "").."]"
|
.."field[0,0.85;2.5,1;search_filter;;"..minetest.formspec_escape(account.search or "").."]"
|
||||||
.."image_button[2.25,0.6;0.8,0.8;commoditymarket_search.png;apply_search;]"
|
.."image_button[2.05,0.65;0.8,0.8;commoditymarket_search.png;apply_search;]"
|
||||||
|
.."image_button[2.7,0.65;0.8,0.8;commoditymarket_clear.png;clear_search;]"
|
||||||
.."checkbox[1.77,0;filter_participating;My orders;".. account.filter_participating .."]"
|
.."checkbox[1.77,0;filter_participating;My orders;".. account.filter_participating .."]"
|
||||||
.."tooltip[filter_participating;Select this to show only the markets where you have either a buy or a sell order pending.]"
|
.."tooltip[filter_participating;Select this to show only the markets where you have either a buy or a sell order pending.]"
|
||||||
.."tooltip[search_filter;Enter substring to search item identifiers for]"
|
.."tooltip[search_filter;Enter substring to search item identifiers for]"
|
||||||
.."tooltip[apply_search;Apply search to outputs]"
|
.."tooltip[apply_search;Apply search to outputs]"
|
||||||
|
.."tooltip[clear_search;Clear search]"
|
||||||
.."container_end[]"
|
.."container_end[]"
|
||||||
|
|
||||||
-- if a visible item market is selected, show the orders for it in detail
|
-- if a visible item market is selected, show the orders for it in detail
|
||||||
@ -664,6 +666,11 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
something_changed = true
|
something_changed = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if fields.clear_search then
|
||||||
|
account.search = ""
|
||||||
|
something_changed = true
|
||||||
|
end
|
||||||
|
|
||||||
if something_changed then
|
if something_changed then
|
||||||
minetest.show_formspec(name, formname, market:get_formspec(account))
|
minetest.show_formspec(name, formname, market:get_formspec(account))
|
||||||
end
|
end
|
||||||
|
BIN
textures/commoditymarket_clear.png
Normal file
BIN
textures/commoditymarket_clear.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 539 B |
@ -3,7 +3,7 @@ commoditymarket_crown.png - from https://commons.wikimedia.org/wiki/File:Farm-Fr
|
|||||||
commoditymarket_moon.png - from https://commons.wikimedia.org/wiki/File:Luneta08.svg by Arturo D. Castillo —Zoram.hakaan— under the CC-BY 3.0 Unported license
|
commoditymarket_moon.png - from https://commons.wikimedia.org/wiki/File:Luneta08.svg by Arturo D. Castillo —Zoram.hakaan— under the CC-BY 3.0 Unported license
|
||||||
commoditymarket_goblin.png - cropped from the "goblins" mod, Copyright 2015 by Francisco "FreeLikeGNU" Athens Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
commoditymarket_goblin.png - cropped from the "goblins" mod, Copyright 2015 by Francisco "FreeLikeGNU" Athens Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
||||||
commoditymarket_empty_shelf.png - from the moreblocks mod's "moreblocks_empty_shelf", under the zlib license by Hugo Locurcio and contributors
|
commoditymarket_empty_shelf.png - from the moreblocks mod's "moreblocks_empty_shelf", under the zlib license by Hugo Locurcio and contributors
|
||||||
commoditymarket_search.png - Copyright © Diego Martínez (kaeza): CC BY-SA 3.0
|
commoditymarket_search.png, commoditymarket_clear.png - Copyright © Diego Martínez (kaeza): CC BY-SA 3.0
|
||||||
commoditymarket_shingles_wood.png is cottages_homedecor_shingles_wood.png from the cottages mod by VanessaE (CC-by-SA 3.0)
|
commoditymarket_shingles_wood.png is cottages_homedecor_shingles_wood.png from the cottages mod by VanessaE (CC-by-SA 3.0)
|
||||||
|
|
||||||
commoditymarket_trade.png, commoditymarket_trade_flag.png, commoditymarket_under.png, and commoditymarket_under_top were created by FaceDeer and released under the CC0 public domain license
|
commoditymarket_trade.png, commoditymarket_trade_flag.png, commoditymarket_under.png, and commoditymarket_under_top were created by FaceDeer and released under the CC0 public domain license
|
||||||
|
Loading…
x
Reference in New Issue
Block a user