unlock screen doesn't unlock screen

Mark Schonewille m.schonewille at economy-x-talk.com
Wed Aug 27 07:36:06 EDT 2014


Hi jbv,

Data processing doesn't slow down because of screen redraws. If a repeat 
loop like yours needs a lot of CPU time, it will take this and less time 
will be left for screen updates.

The lock screen and unlock screen commands themselves also take some 
time. There's a good chance that a smart rewrite of your repeat loop 
without lock and unlock commands will be much faster than a version with 
these commands.

This should work:

   lock screen
   repeat 20000 times
     -- do a lot of things that
     -- don't affect field contents
     -- ...
     -- now we're at the end of the loop
     put myVar into fld myVar
     -- give the GUI time to update
     wait 0 millisecs with messages
   end repeat

The problem isn't that the screen doesn't unlock, but the problem is 
that your repeat loop doesn't give the engine any time to update the GUI.

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Installer Maker for LiveCode:
http://qery.us/468

Buy my new book "Programming LiveCode for the Real Beginner" 
http://qery.us/3fi

LiveCode on Facebook:
https://www.facebook.com/groups/runrev/

On 8/27/2014 13:25, jbv at souslelogo.com wrote:
> Hi list
>
> I have the following loop :
>
>    lock screen
>    repeat 20000 times
>      -- do a lot of things
>      unlock screen
>      put myVar into fld myVar
>      lock screen
>    end repeat
>
> The purpose is to lock the screen so that the heavy data
> processing inside the loop isn't slowed down, but also to
> display the content of myVar at each iteration of the loop.
> But the content of the fld doesn't refresh while the loop runs,
> only when the loop is over... I used to do that with HC, MC
> and earlier versions of Rev and it used to work...
> I'm on OSX 10.5.5 and LC 6.5.2
> Any idea ?
>
> Thanks
> jbv
>





More information about the use-livecode mailing list