can I lock screen over more than one handler?

Trevor DeVore lists at mangomultimedia.com
Wed Jul 5 09:09:15 EDT 2017


On Wed, Jul 5, 2017 at 6:45 AM, Tiemo Hollmann TB via use-livecode <
use-livecode at lists.runrev.com> wrote:
>
>
> Is this possible?
>
> on handler1
>
> lock screen
>
> -- do some stuff here
>
> send "handler2" in 0 milliseconds
>
> end handler1
>
>
>
> on handler2
>
> -- do some other stuff here
>
> unlock screen
>
> end handler2
>

No it is not. From the docs for `lock screen`:

"When all pending handlers are finished executing, the lockScreen property
is set back to false and the user sees the current state of stack windows
on the screen."

The use of the word "pending" is confusing because when you use `send` you
end up with an entry in the `pendingMessages`. But the screen is going to
be unlocked each time through the event loop. If `handler` called
`handler2` directly (without using `send`) then you would not see the
screen update. You should see the result you are looking for if you change
your code to look like this:

```
on handler1
  lock screen

  -- do some stuff here

  handler2
end handler1
```

If you need to call `handler2` in time then you will need to figure out
another approach to updating the screen. Perhaps all screen updates will
need to happen in `handler2`.

-- 
Trevor DeVore
ScreenSteps
www.screensteps.com



More information about the use-livecode mailing list