lock screen gotcha revisited

J. Landman Gay jacque at hyperactivesw.com
Mon Aug 21 15:48:48 EDT 2017

On 8/21/17 1:28 PM, Jonathan Lynch via use-livecode wrote:
> I agree with Bill. If you lock a door twice on a car, it is still just locked. One unlock will open it up. That seems more intuitive.

Initially it's more intuitive, but if it were done this way you couldn't 
have handlers that manage locks both independently and when called from 
amother handler. For example:

on updateThings
   lock screen
   set the rect of <something>
   set the loc of <something else>
   unlock screen
end updateThings

on updateAllButtonLabels
   lock screen
   repeat with i = 1 to the number of btns
     set the label of btn i to the cDefaultLabel of btn i
   end repeat
   unlock screen
end updateAllButtonLabels

In this scenario, I can update only the buttons at any time, as well as 
updating them as part of a larger card update. In either case, the 
screen will remain locked until everything is done.

This is what I was depending on when I noticed that an unlock with a 
visual effect didn't honor the lock count. I was getting unexpected 
visual results when the screen unlocked in a handler being called by a 
larger one that had already locked the screen.

Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com

More information about the Use-livecode mailing list