send "keyUp" / "rawKeyUp" ?
Mike Bonner
bonnmike at gmail.com
Sun Feb 25 09:13:25 EST 2018
A quick example placed in the card script.
local sKeysPushed --keys kept in this variable for the example
on rawkeydown pkey
if sKeysPushed is empty then
put pkey into sKeysPushed
else
put comma & pkey after sKeysPushed
end if
-- You would want to remove this block of course, but for testing
-- it lets you push the shift key to see whats been captured
if the shiftkey is down then
put sKeysPushed
end if
pass rawkeydown --pass the key
end rawkeydown
I know it was just pseudocode, but as far as I know you can't "send" a
message to a key so..
If you want to be able to click a button to send a rawkeydown (rather than
just typing them) you could use something like:
on mouseup
send "rawkeydown 110" to this card
end mouseup
or
on mouseup
displatch "rawkeydown" with (any item of "119,240,43") --<list of
random keys to send
end mouseup
Now.. If you need to track keypresses while NOT actively using your
application, it requires a different method. You'd need to use a different
method. You would need to use a send loop and check the keysdown and build
up your keys list that way. Using this method would be problematic though,
for example.. A user holds a key down long enough for several loops to
happen, so the keysdown would show the key multiple times. Which might be
appropriate if autorepeat is being used, but then you have no idea how many
"repeats" there were because its based on the repeat rate. It would be
very difficult to have much accuracy using this method. (easiest might be
to check current keysdown against previous keysdown and only log if there
is a difference, then use your own noggin to realize that litle is little)
On Sun, Feb 25, 2018 at 3:09 AM, Richmond Mathewson via use-livecode <
use-livecode at lists.runrev.com> wrote:
> Erm . . .
>
> I want to set up a stack that will list an end-user's keyDowns by sending
> their system
> a set of rawKeyUps . . .
>
> PseudoCode:
>
> in a button:
>
> on mouseUp
> send "rawKeyDown" to key 113
> end mouseUp
>
> in the cardScript:
>
> on rawKeyDown XX
> get keyUp XX
> put XX somewhere useful
> end rawKeyDown
>
> Richmond.
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
More information about the use-livecode
mailing list