manve1 Posted August 25, 2012 Share Posted August 25, 2012 Can someone post me LUA code on how to make my LUA code to work? i tried re-making the whole script 10+ times.. and still i get same error.. it doesn't add text to gridList, thank you for helping. I know it is wrong, im just starting to script and learn LUA. gui = guiCreateWindow( 0.1, 0.1, 0.2, 0.65, "Hats", true ) objects = { "WW1 hat", "WW2 hat", } row = guiGridListAddRow ( grid ) myGridList = guiCreateGridList ( 0.1, 0.10, 0.8, 0.60, true, gui ) columnA = guiGridListAddColumn( grid, "ZM hats", 0.85 ) guiGridListSetItemText ( myGridList, row, columnA, "WW1 hat", false, false ) guiGridListSetItemText ( myGridList, row, columnA, "WW2 hat", false, false ) Link to comment
Castillo Posted August 25, 2012 Share Posted August 25, 2012 That's because you forgot to add the row with: guiGridListAddRow Link to comment
manve1 Posted August 25, 2012 Author Share Posted August 25, 2012 Like this never helps most people, can you give example with it? Link to comment
Castillo Posted August 25, 2012 Share Posted August 25, 2012 Click the link which redirects to the wiki and read the example. Link to comment
Anderl Posted August 25, 2012 Share Posted August 25, 2012 local hRow = nil; hWnd = guiCreateWindow( 0.1, 0.1, 0.2, 0.65, "Hats", true ); local aObjects = { "WW1 hat", "WW2 hat"; }; hGrid = guiCreateGridList( 0.1, 0.10, 0.8, 0.60, true, hWnd ); guiGridListAddColumn( hGrid, "ZM hats", 0.85 ); for i,m_obj in ipairs( aObjects ) do hRow = guiGridListAddRow( hGrid ); -- guiGridListSetItemText ( hGrid, hRow, 1, tostring( m_obj ), false, false ); end Isn't that what you want. Link to comment
manve1 Posted August 26, 2012 Author Share Posted August 26, 2012 local hRow = nil; hWnd = guiCreateWindow( 0.1, 0.1, 0.2, 0.65, "Hats", true ); local aObjects = { "WW1 hat", "WW2 hat"; }; hGrid = guiCreateGridList( 0.1, 0.10, 0.8, 0.60, true, hWnd ); guiGridListAddColumn( hGrid, "ZM hats", 0.85 ); for i,m_obj in ipairs( aObjects ) do hRow = guiGridListAddRow( hGrid ); -- guiGridListSetItemText ( hGrid, hRow, 1, tostring( m_obj ), false, false ); end Isn't that what you want. yeh, thank you Link to comment
Anderl Posted August 26, 2012 Share Posted August 26, 2012 local hRow = nil; hWnd = guiCreateWindow( 0.1, 0.1, 0.2, 0.65, "Hats", true ); local aObjects = { "WW1 hat", "WW2 hat"; }; hGrid = guiCreateGridList( 0.1, 0.10, 0.8, 0.60, true, hWnd ); guiGridListAddColumn( hGrid, "ZM hats", 0.85 ); for i,m_obj in ipairs( aObjects ) do hRow = guiGridListAddRow( hGrid ); -- guiGridListSetItemText ( hGrid, hRow, 1, tostring( m_obj ), false, false ); end Isn't that what you want. yeh, thank you You're welcome. 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