Jump to content

Need some help


tim260

Recommended Posts

so i have been reading the wiki lately and i stumbled acros : guiCreateGridList

I dont understand the examples very good so can someone send me an example ( not the one from the wiki wich i dont understand very well )

What i want to do is create xml files and do f.e. something like in the code below

helppages = { 
"helppage1.xml", 
"page2.xml", 
"page3.xml" 

and then the xml wiles would look like this :

<article name> </article name> 
 <content></content> 

if your understanding it im trying to implant that in an F1 help panel.

Thanks for reading

Link to comment
local pages = 
{ 
    "helppage1.xml", 
    "page2.xml", 
    "page3.xml" 
} 
  
GridList = guiCreateGridList ( pX, pY, wX, hY, false ) 
column1 = guiGridListAddColumn ( GridList, "Help", 1.0 ) 
column2 = guiGridListAddColumn ( GridList, "Page 2", 1.0 ) 
column3 = guiGridListAddColumn ( GridList, "Page 3", 1.0 ) 
  
addEventHandler ( "onClientResourceStart", resourceRoot, 
    function ( ) 
        for index, page in pairs">pairs ( pages ) do 
            local loadFiles = xmlCreateFile ( page, "content" ) 
            local newChild = xmlCreateChild ( loadFiles, "article name" ) 
            xmlSaveFile ( loadFiles ) 
             
            row = guiGridListAddRow ( column1 ) 
            row2 = guiGridListAddRow ( column2 ) 
            row3 = guiGridListAddRow ( column3 ) 
             
            if ( row and row2 and row3 and column1 and column2 and column3 ) then 
                local file1 = xmlLoadFile ( "helppage1.xml" ) 
                local file2 = xmlLoadFile ( "page2.xml" ) 
                local file3 = xmlLoadFile ( "page3.xml" ) 
                 
                if ( file1 and file2 and file3 ) then 
                    local node = xmlFindChild ( file1, "article name", 0 ) 
                    local text1 = xmlNodeGetValue ( node1 ) 
                     
                    local node2 = xmlFindChild ( file2, "article name", 0 ) 
                    local text2 = xmlNodeGetValue ( node2 ) 
                     
                    local node3 = xmlFindChild ( file3, "article name", 0 ) 
                    local text3 = xmlNodeGetValue ( node3 ) 
                    guiGridListSetItemText ( GridList, row, column1, text1, false, false ) 
                    guiGridListSetItemText ( GridList, row2, column2, text2, false, false ) 
                    guiGridListSetItemText ( GridList, row3, column3, text3, false, false ) 
                end 
            end 
        end 
    end 
) 

Try it :S Remember, change gridlist positions...

Edited by Guest
Link to comment

f.e. i have this GUI how would i use it to add items to that

addEventHandler("onClientResourceStart",resourceRoot, 
    function() 
        GUIEditor_Window = {} 
        GUIEditor_Button = {} 
        GUIEditor_Grid = {} 
  
        GUIEditor_Window[1] = guiCreateWindow(379,234,319,417,"Construction Panel",false) 
        guiSetAlpha(GUIEditor_Window[1],1) 
        GUIEditor_Grid[1] = guiCreateGridList(18,28,287,293,false,GUIEditor_Window[1]) 
        guiGridListSetSelectionMode(GUIEditor_Grid[1],2) 
  
        guiGridListAddColumn(GUIEditor_Grid[1],"Items",0.2) 
        
    end 
) 

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