scancodes

Mike Bonner bonnmike at gmail.com
Mon Jun 11 15:16:35 EDT 2018


Don't think of a key press and key release as if they should be 2 different
can codes, instead think of them as as being state changes.  Like a light.
Send power to the lightbulb, the light is on. Remove power from the bulb,
the light is off.  The bulb is still the same bulb.   Same with the
keyboard and keycodes.. The light is on! (key pressed)  The light is off!
(key released)  The identifier for the key (the scancode) remains the
same.  Or from a livecode perspective.. Click and hold a button and on
mousedown, report the target.  on mouseup, the same target is reported due
to a state change.  Click begun (mousedown)  click completed (mouseup).  So
no, the scancodes shouldn't be different.  (If you play with an arduino,
the same applies there.  Checking and changing pin states, setting a
voltage high, or low, but the pin assignment remains the same, only its
state changes from high to low, IE on to off)


On Mon, Jun 11, 2018 at 12:51 PM, Richmond Mathewson via use-livecode <
use-livecode at lists.runrev.com> wrote:

> So . . . messing around, as one does, I started to think about scancodes:
> that is to say, signals sent by USB devices (and others)
> when keys are pressed . . .
>
> The main reason for this is that if I have this sort of code in a LiveCode
> stack:
>
> on rawKeyDown RD
>  put RD
> end rawKeyDown
>
> on rawKeyUp RU
>   put RU
> end rawKeyUp
>
> RD and RU will be the same,
>
> while the actual scancodes sent from the keyboard to the computer should
> be different for
> keyDown and keyUp.
>
> I realise that this is fairly silly unless one wants one's program to do
> different things from a keyDown to a keyUp, and that there are
> comparatively straightforward
> ways to ensure this without accessing the scancodes.
>
> Notwithstanding . . .
>
> 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