Lock screen and disable user input

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
kunoir
Posts: 8
Joined: Fri Aug 30, 2013 6:03 am

Lock screen and disable user input

Post by kunoir » Tue Sep 10, 2013 7:12 am

Hi everyone,

First post :D

I am creating a guessing the animal game and have four choices. Once the correct/incorrect animal is chosen I would like to create a green/red square around the choice and lock the screen for 5 seconds.

I just used:

set the visible of graphic correctRectangle to true
lock screen
wait 5 seconds
unlock screen

But when this happens and if you click 5 times on another button during the waiting period it will proceed to process those clicks later.

Anyone know any fixes for this?

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Lock screen and disable user input

Post by Simon » Tue Sep 10, 2013 7:28 am

Hi kunoir,
Welcome to the forum :)

You can use Disable/Enable even on an image.
I'm guessing you code an "on mouseUp" to your images so you would add in the card script a routine to disable all the images for 5 seconds.

Code: Select all

disable image "myImage"

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: Lock screen and disable user input

Post by bn » Tue Sep 10, 2013 9:23 am

Hi kunoir,

you could also use flushevents after your wait.

Wait is blocking and system event might pile up during the wait. That is what you see. Using flushevents you cancel all those piled up system messages.

Code: Select all

set the visible of graphic correctRectangle to true
lock screen
wait 5 seconds
get flushevents ("all") -- <------------
unlock screen
look up flushevents in the dictionary, it is nicely explained, instead of "all" you can flush specific events.

Kind regards
Bernd

kunoir
Posts: 8
Joined: Fri Aug 30, 2013 6:03 am

Re: Lock screen and disable user input

Post by kunoir » Tue Sep 10, 2013 11:09 am

Awesome I will give both these solutions a try and get back to you. Thanks so much for the help.

Post Reply