App Not Responding
BlitzMax Forums/MaxGUI Module/App Not Responding
| ||
hmm...I seem to have a problem that my application gets a "not responding", while I am loading in a big txt-database. Funny thing is that the application is working in the background while I get the "not responding" text, and when the loadin is complete the app wakes up and the gui is active again. When the user starts the program he (or she ofcourse) will see a small window displaying a loading bar, which is created like this. Function CreateLoadWindow() loadingWindow = CreateWindow("Initializing application...", 30, 30, 300, 300) loadingProgressBar = CreateProgBar(20, 20, 100, 20, loadingWindow) loadingLabel = CreateLabel ("", 50, 50, 300, 30, loadingWindow) ShowGadget loadingWindow End Function Then I start to do my loading which looks like this (it's only a part of it): For Local i:Int = 1 To rows marker[0] = rawstring.Find(",") Local regionid:Int = Mid(rawstring, 1, marker[0] ).ToInt() rawstring = Mid(rawstring, marker[0] + 2, 300000) marker[0] = rawstring.Find(",") Local regionName:String = Mid(rawstring, 1, marker[0] ) rawstring = Mid(rawstring, marker[0] + 2, 300000) 'Print i + ": " + regionid + "," + regionname TRegion.Create(regionid, regionname) UpdateLoadingBar(Float(i), Float(rows), "regions") Next The updateloadingBar function looks like this: Function UpdateLoadingBar(completed:Float, total:Float, loadingtext:String) SetGadgetText(loadingLabel, "Loading " + loadingtext + "...") UpdateProgBar loadingProgressBar, (completed / total) End Function In total it takes around 23 seconds to load everything, but somewhere along the way I get the "not responding" text and the GUI stops updating. The progressbar just stops. I tried to add a waitsystem() after each time updateLoadingBar() is called. If I then move the mouse pointer over the app while the loading takes place, the progressbar updates correctly. hehe...but I really don't want to force the user to do this. So it seems like the app looses focus or something. Is there a way to trigger an event that keeps the focus on the app? Any ideas are more than welcome. I have the latest Blitzmax, Maxgui and all modules are synced. |
| ||
Instead of adding WaitSystem(), try using PollSystem() instead inside your loading loop just after your call to UpdateProgBar(). |
| ||
Thanks, that really solved it. I was looking for this kind of command but I forgot about that. Thanks for the help SebHoll! |