Key commands not recognised
Moderator: Klaus
Key commands not recognised
I am using Livecode on an iMac. the 'commandKeyDown' and 'escapeKey' commands don't work, they throw up an error when put into a script. The escapeKey doesn't work with 'keyDown' either. Any ideas?
-
- Livecode Opensource Backer
- Posts: 10096
- Joined: Fri Feb 19, 2010 10:17 am
Re: Key commands not recognised
Indeed:
Mac Mini
LC 9.6.1
macOS 11.0 Beta 5
does nothing at all.
Wonder about a bug report?
However:
this worked:
Mac Mini
LC 9.6.1
macOS 11.0 Beta 5
Code: Select all
on keyDown KD
if the commandKey is down then
put "cmdkey Down" into fld "fff"
end if
end keyDown
on keyUp KP
put empty into fld "fff"
end keyUp
Wonder about a bug report?
However:
this worked:
Code: Select all
on escapeKey
put "Yabba-dabba-doo" into fld "fff"
end escapeKey
-
- VIP Livecode Opensource Backer
- Posts: 10045
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Key commands not recognised
Error messages provide guidance. What does the message you encounter say?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Key commands not recognised
CommandKeyDown is supposed to check if another key is pressed with the command key, according to the livecode dictionary, but isn’t recognised in a script, prompting a red cross. I even copied the script in the dictionary to no avail.
Similarly the escapeKey also produces a red cross.
Similarly the escapeKey also produces a red cross.
-
- Livecode Opensource Backer
- Posts: 10096
- Joined: Fri Feb 19, 2010 10:17 am
Re: Key commands not recognised
Well; here's a thought . . .
If I set up a stack with a field and this in the cardScript:
and I press Command + 'f', the "Find" thingy of LiveCode comes up,
and so on and so forth with ALL the key commands in the LiveCode IDE.
This obviously means that when the commandKey is pressed all things are trapped by the IDE before they get to the cardScript.
I have reported exactly this here: https://quality.livecode.com/show_bug.cgi?id=22881
If I set up a stack with a field and this in the cardScript:
Code: Select all
on keyDown KD
if the commandKey is down then
put "Yup" into fld "Um"
else
put empty into fld "Um"
end if
end keyDown
and so on and so forth with ALL the key commands in the LiveCode IDE.
This obviously means that when the commandKey is pressed all things are trapped by the IDE before they get to the cardScript.
I have reported exactly this here: https://quality.livecode.com/show_bug.cgi?id=22881
Re: Key commands not recognised
@odysseus: commandKeyDown and escapeKey are events to be handled, not commands to be executed. i.e.
Note: You won't get both keyDown and commandKeyDown - you get the former if Cmd is not held down, and the latter if it is.
Code: Select all
on keyDown pKey
answer "The user pressed" && pKey
end keyDown
on commandKeyDown pKey
answer "The user pressed Cmd+" & pKey
end commandKeyDown
on escapeKey
answer "The user pressed escape"
end escapeKey
Last edited by LCMark on Thu Aug 27, 2020 9:42 am, edited 1 time in total.
-
- Livecode Opensource Backer
- Posts: 10096
- Joined: Fri Feb 19, 2010 10:17 am
Re: Key commands not recognised
I understand they are events, my title was misleading, but the point is that on my system ‘on commandKeyDown’ is not recognised at all and causes the red cross to be shown, so the script will obviously not compile.
-
- Livecode Opensource Backer
- Posts: 10096
- Joined: Fri Feb 19, 2010 10:17 am
Re: Key commands not recognised
Dunno: this works with me:
[macOS 11.0 beta 5, LiveCode 9.6.1]
-
-
Mind you; I have a "funny feeling" about pKey.
[macOS 11.0 beta 5, LiveCode 9.6.1]
Code: Select all
on commandKeyDown KD
put KD into fld "ff"
end commandKeyDown
Mind you; I have a "funny feeling" about pKey.

- Attachments
-
- slightly foolish.livecode.zip
- Here's the stack.
- (898 Bytes) Downloaded 120 times
Re: Key commands not recognised
Do you mean that this will not stand happily in the SE?...the point is that on my system ‘on commandKeyDown’ is not recognised at all and causes the red cross to be shown, so the script will obviously not compile.
Code: Select all
on commandkeyDown
end commandKeyDown
-
- Livecode Opensource Backer
- Posts: 10096
- Joined: Fri Feb 19, 2010 10:17 am
Re: Key commands not recognised
Ihope you haven't "been bonkers" like me
and messed around with your modifier keys settings:
-
and messed around with your modifier keys settings:
-