On Apr 25, 2007, at 11:21 AM, Peter K. Stys wrote:

> All we want is:
>
> for j = 1 to 1000000
>   myWindow.myStaticText.text = str(j)
> next
>
> for myStaticText to actually display the progress of the loop as it's
> running (distilled example of course).

I'm confused: what's wrong with just adding a  
myWindow.myStaticText.refresh after the above assignment line?

That works fine for me, though doing it every iteration slows down  
the code considerably. I usually do something like this in my programs:


   dim j as integer

   for j = 1 to 1000000
     staticText1.text = str(j)
     if j mod 1000 = 0 then staticText1.refresh
   next j

This works great. Depending on the length of the loop and the  
frequency of feedback I want I adjust the "1000" number to be about  
ten percent or so of the total.

I use this with ProgressBars as well, not just StaticTexts. If I have  
a bunch of objects to update, I simply call an update method that  
refreshes them all.


Marc Zeedar
Publisher, REALbasic Developer magazine
www.rbdeveloper.com


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to