xyz Posted May 15, 2016 Share Posted May 15, 2016 So I have made a few GUIs with gridlists, I'd like to make a search box as there are many rows in there. How can I make a search box? I mean by like typing into a edit box etc. Link to comment
swedishboy Posted May 16, 2016 Share Posted May 16, 2016 Looking for this? https://wiki.multitheftauto.com/wiki/GuiCreateEdit Link to comment
xyz Posted May 16, 2016 Author Share Posted May 16, 2016 No, I mean like when I type into an edit box, and the items in the gridlist next to it change to the ones you need, like a box for searching, how can I make that? Link to comment
xyz Posted May 16, 2016 Author Share Posted May 16, 2016 No, I mean like when I type into an edit box, and the items in the gridlist next to it change to the ones you need, like a box for searching, how can I make that? Link to comment
Noki Posted May 16, 2016 Share Posted May 16, 2016 function IM.onSearchForPlayer() phone.im.gridlist["players"]:clear() local text = phone.im.edit["search_players"].text for _, plr in ipairs(Element.getAllByType("player")) do if (plr ~= localPlayer and plr.name:lower():find(text:lower())) then local row = guiGridListAddRow(phone.im.gridlist["players"]) guiGridListSetItemText(phone.im.gridlist["players"], row, 1, plr.name, false, false) end end end addEventHandler("onClientGUIChanged", phone.im.edit["search_players"], IM.onSearchForPlayer, false) Here's some code I used to filter players in a gridlist based on name. You can do the same and change the player to a table. Some other edits here and there as well. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now