alien4u Posted March 15, 2016 Share Posted March 15, 2016 (edited) I was having some problems with Progressbar with nested "FOR" Loop but I was using it unnecessarily so I end up with only one "FOR" Loop. Here I'm sharing with you two ways of solve the progressbar problem, this is not for advanced users, this is for reference and newbies like me. And about the progressbar using GUICtrlSetData() with one FOR Loop and variable cicles(for example cicles base of elements on Array with variable size) you can do it as fallow: Note: Does not matter if the Array size is 50 or 5000 the progressbar will work properly. $progress = GUICtrlCreateProgress() Local $count = UBound($Array) Local $imove = ((1 / $count) * 100) ; One is because you will SetData to Progress each 1 cicle. Local $itemp = 0 For $i = 0 To UBound($Array) - 1 ; Your Code could be here $itemp += $imove GUICtrlSetData($progress, $itemp) ; Or your code could be here. Next Another way to do it and I think is more elegant or fancy is like this: $progress = GUICtrlCreateProgress() Local $itemp = 0 Local $count = 0 Local $intcount = Floor(Ubound($Array)/100) For $i = 0 To UBound($Array) - 1 ; Your Code could be here If Mod($i, $intcount) == 0 Then $count = $count+1 GUICtrlSetData($progress, $count) EndIf ; Or your code could be here. Next Kind Regards Alien. Edited April 5, 2016 by alien4u Problem Solved and Show some examples, Fixed Typo Skysnake 1 Link to comment Share on other sites More sharing options...
alien4u Posted March 16, 2016 Author Share Posted March 16, 2016 I Edit my post because I solve my problem and write two examples for people that may need it. And newbies like me. Kind Regards Alien. Link to comment Share on other sites More sharing options...
Skysnake Posted April 4, 2016 Share Posted April 4, 2016 thank you Skysnake Why is the snake in the sky? Link to comment Share on other sites More sharing options...
alien4u Posted April 4, 2016 Author Share Posted April 4, 2016 (edited) 1 hour ago, Skysnake said: thank you Your welcome is nice to know it help someone. Kind Regards Alien. Edited April 4, 2016 by alien4u quote Link to comment Share on other sites More sharing options...
Skysnake Posted April 5, 2016 Share Posted April 5, 2016 If Mod($i, $intcount) == 0 Then $count = $count+1 GUICtrlSetData($progress, $count) ElseIf I am sure that the ElseIf should in fact be EndIf... Gives a smooth ride Skysnake Why is the snake in the sky? Link to comment Share on other sites More sharing options...
alien4u Posted April 5, 2016 Author Share Posted April 5, 2016 Hi @Skysnake you are right, I fix it. Thank You. Link to comment Share on other sites More sharing options...
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