nowofresh Posted June 27, 2011 Share Posted June 27, 2011 (edited) testfunction = function ( ) gridlist = guiCreateGridList( 0.3328, 0.7825, 0.3211, 0.175, true ) guiGridListSetSortingEnabled ( gridlist, false ) c1 = guiGridListAddColumn( gridlist, "Column1", 0.4 ) c2 = guiGridListAddColumn( gridlist, "Column2", 0.2 ) c3 = guiGridListAddColumn( gridlist, "Column3", 0.45 ) --This will be see like this: Column1 Column2 Column3 local row = guiGridListAddRow ( gridlist ) guiGridListSetItemText ( gridlist, row, c1g, "test1", false, false ) guiGridListSetItemText (gridlist, row, c2g, "test2", false, false ) guiGridListSetItemText ( gridlist, row, c4g,"test3", false, false ) guiGridListSetItemData ( gridlist, , row,c1, 15 ) guiGridListSetItemData (gridlist, , row,c2, 20 ) guiGridListSetItemData (gridlist, , row,c3, 201 ) button = guiCreateButton( 0.6600, 0.8750, 0.05, 0.082, "Execute", true ) addEventHandler ( "onClientGUIClick", button, function ( ) local i1, i2 = guiGridListGetSelectedItem ( gridlist ) Here15 = guiGridListGetItemData ( gridlist, i1, 1 ) Here20 = guiGridListGetItemData ( gridlist, i1, 2 ) Here201 = guiGridListGetItemData ( gridlist, i1, 3 ) print( Here15 ) -- print 15 print( Here20 ) -- print 20 print( Here201 ) -- print 201 end ) end If u do this function again and PUT'n'DROP columns u can change them positions... And u can choose them number, for example: Column1 Column3 Column2 or Column3 Column2 Column1 etc. And when code executed you will be showing for example: print( Here15 ) -- print 20 print( Here20 ) -- print 201 print( Here201 ) -- print 15 Maybe i bad using item data or mta has bug. Please, tell me how to fix that, because this is very important for me. Thanks, Edited June 27, 2011 by Guest Link to comment
JR10 Posted June 27, 2011 Share Posted June 27, 2011 testfunction = function ( ) gridlist = guiCreateGridList( 0.3328, 0.7825, 0.3211, 0.175, true ) guiGridListSetSortingEnabled ( gridlist, false ) c1 = guiGridListAddColumn( gridlist, "Column1", 0.4 ) c2 = guiGridListAddColumn( gridlist, "Column2", 0.2 ) c3 = guiGridListAddColumn( gridlist, "Column3", 0.45 ) --This will be see like this: Column1 Column2 Column3 local row = guiGridListAddRow ( gridlist ) guiGridListSetItemData ( gridlist, row,c1, 15 ) guiGridListSetItemData (gridlist,row,c2, 20 ) guiGridListSetItemData (gridlist,row,c3, 201 ) button = guiCreateButton( 0.6600, 0.8750, 0.05, 0.082, "Execute", true ) addEventHandler ( "onClientGUIClick", button, function ( ) local i1, i2 = guiGridListGetSelectedItem ( gridlist ) Here15 = guiGridListGetItemData ( gridlist, i1, 1 ) Here20 = guiGridListGetItemData ( gridlist, i1, 2 ) Here201 = guiGridListGetItemData ( gridlist, i1, 3 ) print( tostring(Here15) ) -- print 15 print( tostring(Here20) ) -- print 20 print( tostring(Here201) ) -- print 201 end ) end Link to comment
nowofresh Posted June 27, 2011 Author Share Posted June 27, 2011 MTA developers done error like me in admin resource: aCurrentVehicle = tonumber ( guiGridListGetItemData ( aTab1.VehicleOptions, item, 1 ) ) Link to comment
JR10 Posted June 27, 2011 Share Posted June 27, 2011 THERE IS NO ERROR OR BUG IN MTA IN THE SECTION YOU ARE TALKING ABOUT IS THAT HARD TO UNDERSTAND?? any problem you face is not just "Mta Bug !!!", did u use test function??, did u add it onClientResourceStart addEventHandler('onClientResourceStart', resourceRoot, function() testfunction end ) Link to comment
nowofresh Posted June 27, 2011 Author Share Posted June 27, 2011 Ok, ok... i am talking about item data and column problem. Link to comment
JR10 Posted June 27, 2011 Share Posted June 27, 2011 Well, there is no BUGS in the grid list why do you use print shouldnt it be outputChatBox?? Link to comment
nowofresh Posted June 27, 2011 Author Share Posted June 27, 2011 ... It is example code !.. , and i asked about columns. Link to comment
JR10 Posted June 27, 2011 Share Posted June 27, 2011 set Item data will only work after you set the item text. Link to comment
nowofresh Posted June 27, 2011 Author Share Posted June 27, 2011 Changed... I am using MTA 1.1. In my own code I do it by iteration... 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