Jump to content

Freeroam Gridlist colors


denny199

Recommended Posts

Hey there, i was wondering, can i change the color off the gridlist example vehicles:

I'm using this:

guiGridListSetItemColor (wndCreateVehicle, rows, columns, 255,0,0) 

but now a error, btw, i don't know what the gridlist is.

error: attempt to call a boolean value

error: expected gui element @ argument 1

--------------------------- 
-- Create vehicle window 
--------------------------- 
function createSelectedVehicle(leaf) 
    if not leaf then 
        leaf = getSelectedGridListLeaf(wndCreateVehicle, 'vehicles') 
        if not leaf then 
            return 
        end 
    end 
    server.giveMeVehicles(leaf.id) 
end 
  
wndCreateVehicle = { 
    'wnd', 
    text = 'Create vehicle', 
    width = 300, 
    controls = { 
        { 
            'lst', 
            id='vehicles', 
            width=280, 
            height=340, 
            columns={ 
                {text='Vehicle', attr='name'} 
            }, 
            rows={xml='vehicles.xml', attrs={'id', 'name'}}, 
            onitemdoubleclick=createSelectedVehicle 
        }, 
  
--Error here 
--guiGridListSetItemColor (wndCreateVehicle, rows, columns, 255,0,0) 
-- i setted this but a error:/ 
  
        {'btn', id='create', onclick=createSelectedVehicle}, 
        {'btn', id='close', closeswindow=true} 
    } 
} 
  
  
  

Link to comment

That'll never work.

You can do this:

addEventHandler("onClientGUIClick",root, 
    function () 
        if ( source == getControl(wndCreateVehicle,"vehicles") ) then 
            for row=0, guiGridListGetRowCount(getControl(wndCreateVehicle, "vehicles")) do 
                guiGridListSetItemColor(getControl(wndCreateVehicle, "vehicles"),row,1,0,255,0) 
            end 
        end 
    end 
) 

It'll set the all grid list rows to green.

  • Like 1
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...