Key lock

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

liveCode
Posts: 124
Joined: Sun Oct 17, 2021 5:53 pm

Key lock

Post by liveCode » Tue Aug 13, 2024 4:23 pm

Is there a code that causes them not to be able to press keys on the keyboard? (by pressing them the computer will not respond)

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Key lock

Post by dunbarx » Tue Aug 13, 2024 5:08 pm

Hi.

You can trap "rawKeyDown" and "rawkeyUp".

That should prevent anything the user does.


Craig

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Key lock

Post by dunbarx » Tue Aug 13, 2024 5:13 pm

Be careful where you put that, like a frontScript, or at least remember where. :wink:

Craig

liveCode
Posts: 124
Joined: Sun Oct 17, 2021 5:53 pm

Re: Key lock

Post by liveCode » Tue Aug 13, 2024 6:34 pm

Thanks for the answer
Can you give me an example of the code that causes them not to be able to press the windows start key?

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Key lock

Post by Klaus » Tue Aug 13, 2024 6:52 pm

You can only prevent pressing keys on the keyboard INSIDE of your standalone!
We can NOT control anything outside your app, like the Windows key or whatever...

liveCode
Posts: 124
Joined: Sun Oct 17, 2021 5:53 pm

Re: Key lock

Post by liveCode » Tue Aug 13, 2024 7:01 pm

Is it possible to prevent the mouse from moving outside the stack boundaries?

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Key lock

Post by Klaus » Tue Aug 13, 2024 7:10 pm

No.


Your message contains 3 characters.
You need to enter at least 10 characters.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Key lock

Post by dunbarx » Tue Aug 13, 2024 8:51 pm

Is it possible to prevent the mouse from moving outside the stack boundaries?
Yes. Here is a piece of the solution. It will prevent the cursor from moving past the right of the card window:

Code: Select all

on mouseMove x,y
   if item 1 of the mouseLoc > the right of this cd - 20 then set the screenmouseLoc to x - 20 & "," & y + the top of this stack
end mouseMove
You would need to include all four sides of the card window for a complete solution.

Craig
Last edited by dunbarx on Tue Aug 13, 2024 8:59 pm, edited 3 times in total.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Key lock

Post by dunbarx » Tue Aug 13, 2024 8:52 pm

Klaus.
Your message contains 3 characters.
You need to enter at least 10 characters.
???

Craig

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Key lock

Post by dunbarx » Tue Aug 13, 2024 8:55 pm

LiveCode.

The handler I gave is not perfect. System and LC timing will not prevent a fast movement of the mouse from penetrating that border. It will prevent moderate motion, however. The arbitrary values of "20" in the handler just give LC some breathing space. If you reduce those values, you can set up closer to the border, but the ability to blast through increases.

Anyone know how to "Speed up" the reaction time for this handler?

Craig

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Key lock

Post by Klaus » Tue Aug 13, 2024 9:31 pm

dunbarx wrote:
Tue Aug 13, 2024 8:52 pm
Klaus.
Your message contains 3 characters.
You need to enter at least 10 characters.
???
Craig
Try it yourself:
Enter a word with less than 10 characters as a response and click "Submit" :-)

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Key lock

Post by dunbarx » Tue Aug 13, 2024 10:22 pm

Klaus.

Where did that come up?

Craig

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Key lock

Post by Klaus » Wed Aug 14, 2024 8:50 am

See attached screenshot...
too_few_chars.png

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Key lock

Post by dunbarx » Wed Aug 14, 2024 2:32 pm

Klaus.

Well, since you are a moderator I assumed you saw something I did not. Anyway, I do not see that in my thread. Did you delete it?

Craig

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Key lock

Post by Klaus » Wed Aug 14, 2024 2:46 pm

OK, I will explain this very slowly... :-D

I wanted to respond to the namely posting with just "no."
But the forum software does not allow words shorter than 10 characters, therefore that warning appeared
on top of the entry field as seen in my screenshot. So I simply added this error text to satisfy the forum software.

This has nothing to do with being a moderator or no, this will also happen to you in that case!

Post Reply