Display a Counter

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
lohill
Posts: 770
Joined: Tue Dec 08, 2009 6:37 pm

Display a Counter

Post by lohill » Mon Apr 29, 2013 1:05 am

I would like to display a counter as my program goes through some nested repeat statements. I have been using code that looks like this but nothing shows up in the field until the whole thing is done.

Code: Select all

 put tCounter & " of " & tTotal into field "Count"
Since there are over 93,000 'counts' so I don't want to slow the program down unnecessarily.

Larry

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Display a Counter

Post by sturgis » Mon Apr 29, 2013 1:12 am

There will be some slowdown with this method, but if you put a

wait 0 with messages

in the loop somewhere the counter should then visibly update. wait with messages gives the engine some breathing room to complete things (like updating the display) but there will be an impact on your app. You might consider not updating on every single loop and only update the counter field every hundred or so. (or after a period of time or whatever)

lohill
Posts: 770
Joined: Tue Dec 08, 2009 6:37 pm

Re: Display a Counter

Post by lohill » Mon Apr 29, 2013 4:49 pm

Thanks Sturgis.

That was perfect. I actually am using 300.

Larry

Post Reply