Assigning a keyboard shortcut to a button

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

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10098
Joined: Fri Feb 19, 2010 10:17 am

Re: Assigning a keyboard shortcut to a button

Post by richmond62 » Sat Feb 12, 2022 4:41 pm

SShot 2022-02-12 at 17.40.18.png
Attachments
Key Reporter 2.livecode.zip
Stack.
(1.09 KiB) Downloaded 162 times


glenn9
Posts: 234
Joined: Wed Jan 15, 2020 10:45 pm

Re: Assigning a keyboard shortcut to a button

Post by glenn9 » Mon Feb 14, 2022 2:26 pm

jacque wrote:
Fri Feb 11, 2022 11:03 pm
Now that I'm at the computer I see the problem. Here's a revised script that should account for either one of the alt keys.

Code: Select all

on rawkeyDown pKey
  put (65513 is in the keysdown or 65514 is in the keysdown) into tAltKeyTrue
  if tAltKeyTrue and pKey = 115 then
    answer "alt" 
  else
    pass rawkeydown
  end if
end rawkeyDown
Thanks Jacque, have just seen this, I'll give this a try... Regards, Glenn

glenn9
Posts: 234
Joined: Wed Jan 15, 2020 10:45 pm

Re: Assigning a keyboard shortcut to a button

Post by glenn9 » Mon Feb 14, 2022 3:40 pm

glenn9 wrote:
Mon Feb 14, 2022 2:26 pm
jacque wrote:
Fri Feb 11, 2022 11:03 pm
Now that I'm at the computer I see the problem. Here's a revised script that should account for either one of the alt keys.

Code: Select all

on rawkeyDown pKey
  put (65513 is in the keysdown or 65514 is in the keysdown) into tAltKeyTrue
  if tAltKeyTrue and pKey = 115 then
    answer "alt" 
  else
    pass rawkeydown
  end if
end rawkeyDown
Thanks Jacque, have just seen this, I'll give this a try... Regards, Glenn
Hi Jacque, just tried your code.... I think it must be my set up as it again only fires when the 'Alt Gr' key is down!!

Grateful for the suggestion though.

Regards,

Glenn

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7391
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Assigning a keyboard shortcut to a button

Post by jacque » Mon Feb 14, 2022 8:56 pm

Have you double-checked that my two keycodes are correct? I just copied them from Richmond's post, but maybe yours are different.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply