On 12/30/18 1:25 PM, Malte Pfaff-Brill via use-livecode wrote:
Hi Kaveh,

Thanks for the kind words. :-)

Regarding lock screen, here is one simple example:

on mouseUp
        lock screen
        subhandler
        unlock screen
        answer the lockscreen
end mouseUp


on subhandler
        lock screen
        — other stuff may follow, but do not unlock
end subhandler

My expectation in the answer would be „false“, but guess what. :-)
Regarding screen not being immediately released, I am not down to the cause 
yet. App is complex (multi group / people calendar)

I want to strongly disagree with your conclusion here.

Locking and unlocking the screen is a matter of counting when it comes to nesting. In your example, the mouseUp handler increments the count to 1, then the subhandler increases it to 2, and finally the mouseUp handler decrements the count with the unlock command. That still leaves the lock counter nonzero, so the screen is still locked.

A more correct approach would be to unlock the screen at the end of the subhandler, i.e., lock the screen when you need it locked, then unlock it *in the same handler* when you're done needing it locked. I nest lock and unlock commands all the time, and it's second nature now to pair them the same way I pair if/end if, repeat/end repeat, etc.

--
 Mark Wieder
 ahsoftw...@gmail.com

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to