Article Preview
Buy Now
COLUMN
Updating the ProgressBar
Manipulating the UI During a Long Process
Issue: 16.5 (September/October 2018)
Author: Marc Zeedar
Author Bio: Marc taught himself programming in high school when he bought his first computer but had no money for software. He's had fun learning ever since.
Article Description: No description available.
Article Length (in bytes): 11,085
Starting Page Number: 76
Article Number: 16506
Resource File(s):
project16506.zip Updated: 2018-08-31 11:10:06
Related Web Link(s):
http://developer.xojo.com/userguide/threading
http://docs.xojo.com/index.php/DoEvents
Excerpt of article text...
I received an email from an
xDev reader asking for help with hisProgressBar
code that was broken. His method used to work, but recently stopped—likely due to a change in how Xojo functions.His original code was simple enough, so at first I was perplexed as I have used similar methods in the past. I won't replicate his code here, but it's simple enough.
He basically had a window object with a
ProgressBar
controller on it. A method on the window would initialize, update, and close the window based on the parameters passed. In other words, he'd pass a key that indicated "initialize" mode and it would set up theProgressBar
, while a key for "update" would change the value of theProgressBar
and redraw it, and so on.The problem was when he encountered a long process (such as a loop) and tried to call his
ProgressBar
routine, nothing would be updated. TheProgressBar
would always stay the same until the task would finish without any progress being shown to the user.Debugging the Problem
Usually, when I get code from another person, it's difficult to debug as I'm not sure if there's an error in their code, which is hard to deduce without an extensive understanding of their code, or if the problem lies elsewhere (i.e. Xojo or operating system).
...End of Excerpt. Please purchase the magazine to read the full article.