Jump to content

[Help/GUI] Store, read and use data from a gridlist


Recommended Posts

Posted

I got the XML file made, but now it doesn't read or misses the table, nor does it add rows/values into the gridlist.

  
function setRadioChannel(button, state) 
    local channel = xmlNodeGetChildren(xmlRootTree) 
    if (source == bChanSet) then 
        for k, v in ipairs(channel) do 
        local channelFreq = guiGetText(eChanFreq) 
        local channelDesc = guiGetText(eChanDesc) 
        local row = guiGridListAddRow(gRadioGrid) 
            if channelFreq then 
                guiGridListSetItemText( gRadioGrid, row, colFreq, channelFreq, false, false) 
                guiGridListSetItemData( gRadioGrid, row, colFreq, channelFreq) 
                outputDebugString("channelFreq Read, value " .. tostring(channelFreq) "set to row " .. tostring(row)) 
            end 
            if channelDesc then 
                guiGridListSetItemText( gRadioGrid, row, colDesc, channelDesc, false, false) 
                guiGridListSetItemData( gRadioGrid, row, colDesc, channelDesc) 
                outputDebugString("channelFreq Read, value " .. tostring(channelDesc) "set to row " .. tostring(row)) 
            end 
        end 
    end 
end 
addEventHandler("onClientGUIClick", getRootElement(), setRadioChannel) 
  

Posted

How you want to load something that doesn't exist? you aren't writting anything on the file, also, you should load them on start, not when you add it.

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...