..:D&G:.. Posted May 24, 2015 Share Posted May 24, 2015 Hello, I got a quick question, how do I get all the rows from a gridlist? I got this gridlist: Inter.grid.list = guiCreateGridList(9, 181, 452, 369, false, Inter.window) and I want to get all the rows instead of using: local row, _ = guiGridListGetSelectedItem ( Inter.grid.list ); Link to comment
WhoAmI Posted May 24, 2015 Share Posted May 24, 2015 Well, while you inserting row into gridlist, insert it also into table. Link to comment
..:D&G:.. Posted May 24, 2015 Author Share Posted May 24, 2015 Well, while you inserting row into gridlist, insert it also into table. Lol, didn't think about that thanks Link to comment
..:D&G:.. Posted May 24, 2015 Author Share Posted May 24, 2015 Ok, I did what you said and got this: elseif ( source == Inter.btn.downloadAll ) then for i, v in pairs ( Inter.rows ) do local row = unpack(v) local name = guiGridListGetItemText ( Inter.grid.list, row, 1) local dtxd = Downloader.Mods[ name ].txd local ddff = Downloader.Mods[ name ].dff triggerEvent("startDownloadModSelected", root, dtxd, ddff) Inter.refresh ( ); end The thing is that MTA freezes as it downloads all the mods at the same time. How can I make the mods add to the download at an interval of 5 seconds? What I mean is, how can I get each row at an interval of 5 seconds? I was thinking of setTimer but it doesn't seem to be the right thing to do Link to comment
xXMADEXx Posted May 24, 2015 Share Posted May 24, 2015 [quote name=..&G:..]Ok, I did what you said and got this: elseif ( source == Inter.btn.downloadAll ) then for i, v in pairs ( Inter.rows ) do local row = unpack(v) local name = guiGridListGetItemText ( Inter.grid.list, row, 1) local dtxd = Downloader.Mods[ name ].txd local ddff = Downloader.Mods[ name ].dff triggerEvent("startDownloadModSelected", root, dtxd, ddff) Inter.refresh ( ); end The thing is that MTA freezes as it downloads all the mods at the same time. How can I make the mods add to the download at an interval of 5 seconds? What I mean is, how can I get each row at an interval of 5 seconds? I was thinking of setTimer but it doesn't seem to be the right thing to do Yes, you can use setTiemr to do this. Try this: elseif ( source == Inter.btn.downloadAll ) then for i, v in pairs ( Inter.rows ) do setTimer ( function ( v ) local row = unpack(v) local name = guiGridListGetItemText ( Inter.grid.list, row, 1) local dtxd = Downloader.Mods[ name ].txd local ddff = Downloader.Mods[ name ].dff triggerEvent("startDownloadModSelected", root, dtxd, ddff) Inter.refresh ( ); end, (i-1)*5000, 1, v ); end Link to comment
..:D&G:.. Posted May 24, 2015 Author Share Posted May 24, 2015 Yes, you can use setTiemr to do this. Try this: elseif ( source == Inter.btn.downloadAll ) then for i, v in pairs ( Inter.rows ) do setTimer ( function ( v ) local row = unpack(v) local name = guiGridListGetItemText ( Inter.grid.list, row, 1) local dtxd = Downloader.Mods[ name ].txd local ddff = Downloader.Mods[ name ].dff triggerEvent("startDownloadModSelected", root, dtxd, ddff) Inter.refresh ( ); end, (i-1)*5000, 1, v ); end Lol, I always think of noobish way to do them, and look stupid may I know what this means? end, (i-1)*5000, 1, v ); Link to comment
WhoAmI Posted May 24, 2015 Share Posted May 24, 2015 If you want 5s interval, for i, v in pairs ( Inter.rows ) do local row = unpack(v) local name = guiGridListGetItemText ( Inter.grid.list, row, 1) local dtxd = Downloader.Mods[ name ].txd local ddff = Downloader.Mods[ name ].dff local t = ( i - 1 ) * 5000 setTimer ( function ( ) triggerEvent("startDownloadModSelected", root, dtxd, ddff) end, ( t == 0 ) and 50 or t, 1 ); Inter.refresh ( ); end 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