Recognising enter/return button
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Recognising enter/return button
Hey, what code would i have to use in order for livecode to recognize that when someone presses the enter/return button in order to make my game change cards
Re: Recognising enter/return button
Hi,17rag01l wrote:Hey, what code would i have to use in order for livecode to recognize that when someone presses the enter/return button in order to make my game change cards
You could try this:
create a field and type this line of code:
Code: Select all
on rawkeyup k
put k
end rawkeyup
HTH,
Thierry
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!
-
- VIP Livecode Opensource Backer
- Posts: 327
- Joined: Sun Apr 15, 2012 1:17 am
- Location: USA
- Contact:
Re: Recognising enter/return button
Look up returnInField in the dictionary
Code: Select all
on returnInField
go to next
end returnInField
Cyril Pruszko
https://sites.google.com/a/pgcps.org/livecode/
https://sites.google.com/a/setonhs.org/app-and-game-workshop/home
https://learntolivecode.com/
https://sites.google.com/a/pgcps.org/livecode/
https://sites.google.com/a/setonhs.org/app-and-game-workshop/home
https://learntolivecode.com/
Re: Recognising enter/return button
Hi,
following Thierrys reply about rawKeys:
Explanation:
"RawKeyValue", "Shortcut", "KeyName"
These are the ones I'm using when working with keyboard navigation. This is in a custom stack prop, and I use them in a rawKeyDown handler to determine if to fire a command (using the shortcut values).
You're trying to distinguish between RETURN & ENTER, right?
Have fun!
following Thierrys reply about rawKeys:
Code: Select all
65307,SEL,Escape
65293,RET,Return
65421,ENT,Enter
65362,AUP,Arrow Up
65364,ADN,Arrow Down
65361,ALF,Arrow Left
65363,ART,Arrow Right
"RawKeyValue", "Shortcut", "KeyName"
These are the ones I'm using when working with keyboard navigation. This is in a custom stack prop, and I use them in a rawKeyDown handler to determine if to fire a command (using the shortcut values).
Code: Select all
on rawkeydown tC -- check for custom commands:
get item 2 of line lineoffset(tC & ",", the RawKeyVals of this stack) of the RawKeyVals of this stack
if it is empty then -- not in list, nothing to do
pass rawkeydown
else
-- here: Call command for the key-shortcut (or error handler)
exit rawkeydown
end if
end rawkeydown
Have fun!
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!