AMARANT Posted July 1, 2012 Share Posted July 1, 2012 How can I set the size of my gridlist automatically depending on the number of rows in it? Link to comment
Guest Guest4401 Posted July 1, 2012 Share Posted July 1, 2012 Do you mean columns? Because rows don't need an autosize. guiGridListAutoSizeColumn Link to comment
Anderl Posted July 1, 2012 Share Posted July 1, 2012 He mean set the size of the gridlist automatically the same as the rows. Link to comment
Castillo Posted July 1, 2012 Share Posted July 1, 2012 I don't understand why would you do that, the grid list has a scroll. Link to comment
AMARANT Posted July 2, 2012 Author Share Posted July 2, 2012 Solidsnake, the thing is that in my gridlist might be either one row or twenty rows. So I thought that I could make some kind of autosized gridlist but all my attempts with loop and counting rows led to no good Link to comment
Castillo Posted July 2, 2012 Share Posted July 2, 2012 Why can't you resize it every time you add a row? GUIEditor_Grid = {} GUIEditor_Grid[1] = guiCreateGridList(379,0,203,25,false) guiGridListAddColumn(GUIEditor_Grid[1],"Items:",0.70) for index = 1, 40 do local row = guiGridListAddRow ( GUIEditor_Grid[1] ) guiGridListSetItemText ( GUIEditor_Grid[1], row, 1, "Item ".. index, false, false ) local x, y = guiGetSize ( GUIEditor_Grid[1], false ) guiSetSize ( GUIEditor_Grid[1], x, y + 15, false ) end I'd that as test, it leaves some space though. Link to comment
GhostXoP Posted July 2, 2012 Share Posted July 2, 2012 Unless i misunderstand the question, doesn't the gridlist automatically add a scroll bar if height or width bigger then window? Link to comment
Castillo Posted July 2, 2012 Share Posted July 2, 2012 Yes, gridlist element includes a scroll bar. Link to comment
AMARANT Posted July 2, 2012 Author Share Posted July 2, 2012 Solidsnake14, thanks for your example. My attempt had some empty space too but it was much more bigger than yours. I think that will do for me. Thanks again. Link to comment
Castillo Posted July 2, 2012 Share Posted July 2, 2012 I'm glad that it helped. 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