Jump to content

Search in Grid


SiN!X ~

Recommended Posts

kk

cc

  
addEvent("sendMaps", true ) 
function sendmaps(name) 
        row = guiGridListAddRow ( mapGridList ) 
        guiGridListSetItemText ( mapGridList, row, mapsColumn, name, false, false ) 
end 
addEventHandler( "sendMaps", getLocalPlayer(), sendmaps ) 
      
function set1( ) 
        selectedRow, selectedCol = guiGridListGetSelectedItem( mapGridList ) 
        gridMapName = guiGridListGetItemText( mapGridList, selectedRow, selectedCol ) 
        guiSetText( mapNameEdit, gridMapName ) 
end 
addEventHandler( "onClientGUIClick", mapGridList, set1 ) 
  
addEvent( "clearGridList", true ) 
function clearGridList() 
    guiGridListClear( mapGridList ) 
end 
  
--[[   ]]--    
addEventHandler("onClientGUIChanged", SearchMaps, 
        function(mapNameEdit) 
            local mapsearch = guiGetText(mapNameEdit) 
            guiGridListClear(mapGridList) 
            for i = 0, row do 
                if string.find(tostring(name[i]), mapsearch, 1, false) then 
                    local row = guiGridListAddRow(mapGridList) 
                    guiGridListSetItemText(mapGridList, row, 1, tostring(name[i]), false, false) 
                end 
            end 
        end 
    ) 
   
  

do you want ServerMap.lua ?

Link to comment

Hmmm, the truth is, in the topic i gave you, there isn't the full code to search as i can see, there are missing parts.

Edit: Try this:

mapTable = {} 
  
function sendmaps(name) 
    row = guiGridListAddRow ( mapGridList ) 
    guiGridListSetItemText ( mapGridList, row, mapsColumn, name, false, false ) 
    table.insert(mapTable, {tostring(name)}) 
end 
addEvent("sendMaps", true ) 
addEventHandler( "sendMaps", getRootElement(), sendmaps ) 
      
function set1( ) 
    selectedRow, selectedCol = guiGridListGetSelectedItem( mapGridList ) 
    gridMapName = guiGridListGetItemText( mapGridList, selectedRow, selectedCol ) 
    guiSetText( mapNameEdit, gridMapName ) 
end 
addEventHandler( "onClientGUIClick", mapGridList, set1, false ) 
  
function clearGridList() 
mapTable = {} 
guiGridListClear( mapGridList ) 
end 
addEvent( "clearGridList", true ) 
addEventHandler("clearGridList",getRootElement(),clearGridList) 
  
addEventHandler("onClientGUIChanged", SearchMaps, 
function () 
guiGridListClear ( mapGridList ) 
local text = guiGetText ( mapNameEdit ) 
if (text ~= "") then 
for i, v in ipairs (mapTable) do 
row = guiGridListAddRow(mapGridList) 
if ( string.find ( string.upper ( tostring(v[1]) ), string.upper ( text ), 1, true ) ) then 
guiGridListSetItemText(mapGridList, row, 1, tostring(v[1]), false, false) 
end 
end 
else 
for i, v in ipairs (mapTable) do 
row = guiGridListAddRow(mapGridList) 
guiGridListSetItemText(mapGridList, row, 1, tostring(v[1]), false, false) 
    end 
  end 
end) 

Edited by Guest
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...