tim260 Posted March 14, 2012 Share Posted March 14, 2012 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
Absence2 Posted March 14, 2012 Share Posted March 14, 2012 local xml1 = xmlLoadFile( "page.xml" ) local contents1 = xmlNodeGetValue( xml1 ) guiCreateGridList(0.03,0.03,0.94,0.95,contents1,true,page) You mean like this? Link to comment
drk Posted March 14, 2012 Share Posted March 14, 2012 (edited) 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 Remember, change gridlist positions... Edited March 14, 2012 by Guest Link to comment
Castillo Posted March 14, 2012 Share Posted March 14, 2012 @Draken: That script make's no sense, you're setting the text of the rows with the return of xmlLoadFile which isn't the content of course. Link to comment
Castillo Posted March 14, 2012 Share Posted March 14, 2012 You can't use numbers as variable names. You should test what you post. Link to comment
drk Posted March 14, 2012 Share Posted March 14, 2012 I can't test now Anyway I will try to solve this shit.. Link to comment
Cadu12 Posted March 14, 2012 Share Posted March 14, 2012 You can't use numbers as variable names, it'll get error. Link to comment
drk Posted March 14, 2012 Share Posted March 14, 2012 You can't use numbers as variable names, it'll get error. Why post again lol Solidsnake said.. Link to comment
tim260 Posted March 15, 2012 Author Share Posted March 15, 2012 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
Castillo Posted March 15, 2012 Share Posted March 15, 2012 Use: guiGridListAddRow and guiGridListSetItemText Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now