best way of updating a progbar

BlitzMax Forums/MaxGUI Module/best way of updating a progbar

PantsOn(Posted 2007) [#1]
I've got an intesnse process loop and would like to cerate a progress bar.
I have created progress bar but it doesn't update (the whole window is disabled). I belive this is due to the processing in the background.

How can i force an update or slow my loop down so windows can update the app window?


Rimmsy(Posted 2007) [#2]
you could pop a delay 1 or flip and cls. Don't forget that without cls or flip your screen will appear static. This comes at a price though, because loading takes longer if you show it with a flip and delay.

Oh, and if you're going to do a progress bar then please, when it reaches 100%, it's done. Not still loading. i really hate that in games. You sit there waiting for it and when it gets to 100% (theoretically done), it still continues to load!

function loadgame()

showProgressBar(50,"loading people")
loadPeople()

showProgressBar(99,"Loading tanks")
loadTanks()

end function

function showProgressBar(perc,st$)
cls

drawrect 10,10,perc,10
drawtext st,10,22

flip
delay 1
end function



grable(Posted 2007) [#3]
for the ProgressBar gadget, put a PollSystem() inside the loop. that should take care of it =)


PantsOn(Posted 2007) [#4]
cheers grable, i will try the pollsystem() command.
rimmsy.. that code would work for max2d, but I was after something for the GUI module.


PantsOn(Posted 2007) [#5]
that worked, cheers


Rimmsy(Posted 2007) [#6]
Doh!