Jump to content

Grid lists


Drakath

Recommended Posts

I have a strange problem with grid lists.

Here is the code:

window = guiCreateWindow(0.8,0.30,0.20,0.40,"xD",true)       
        animsTP = guiCreateTabPanel(0.11, 0.19, 0.79, 0.66, true, window) 
        FanimsTab = guiCreateTab("ok", animsTP)  
        stfu = guiCreateTab("blablabla", animsTP)  
        FanimsGL = guiCreateGridList(0.01, 0.00, 0.99, 0.84, true, FanimsTab) 
            guiGridListAddColumn(FanimsGL, "", 0.85) 
            guiGridListSetSelectionMode(FanimsGL, 0) 
  
function whatever() 
    local xmlFile = xmlLoadFile("test.xml") 
    if xmlFile then 
        if guiGridListClear(FanimsGL) then 
            for key, node in pairs(xmlNodeGetChildren(xmlFile)) do 
                local block = xmlNodeGetAttribute(node, "block") 
                local anim = xmlNodeGetAttribute(node, "animation") 
             
                local row = guiGridListAddRow(FanimsGL) 
                guiGridListSetItemText(FanimsGL, row, 1, tostring(block), false, false) 
                guiGridListSetItemData(FanimsGL, row, 1, tostring(key)) 
                guiGridListSetItemText(FanimsGL, row, 2, tostring(anim), false, false) 
                guiGridListSetItemData(FanimsGL, row, 2, tostring(anim)) 
                local anim1 = guiGridListGetItemData(FanimsGL, guiGridListGetSelectedItem(FanimsGL), 2) 
                local anim2 = guiGridListGetItemText(FanimsGL, guiGridListGetSelectedItem(FanimsGL), 2) 
                local block1 = guiGridListGetItemText(FanimsGL, guiGridListGetSelectedItem(FanimsGL), 1) 
                 
                outputChatBox(anim1) 
                outputChatBox(anim2) 
                outputChatBox("anim: "..tostring(anim)) 
                 
                setPedAnimation(block1, anim2) 
                 
            end 
        end 
    end 
end 
addEventHandler("onClientGUITabSwitched", FanimsTab, whatever) 

anim1 outputs nil

anim2 outputs space

tostring(anim) outputs anim: thrw_barl_thrw

Why doesn't anim2 output the text of gridlist item? How can I make it output it? Obviously there is no animation as well.

test.xml:

<test> 
    <animation block="AIRPORT" animation="thrw_barl_thrw"></animation> 
</test> 
  

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