Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #30733

Re: Interrogation of Shift-Key state

Path csiph.com!weretis.net!feeder4.news.weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: Interrogation of Shift-Key state
Date Sat, 25 Jun 2016 20:17:56 +0200
Organization PointedEars Software (PES)
Lines 55
Message-ID <1652837.7Z3S40VBb9@PointedEars.de> (permalink)
References <nklv6p$eap$1@gioia.aioe.org> <9a42c75f-3239-4a70-9ce3-7434db0edd00@googlegroups.com> <nkmg47$1b8k$2@gioia.aioe.org>
Reply-To Thomas 'PointedEars' Lahn <cljs@PointedEars.de>
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding 8Bit
X-Trace solani.org 1466878677 3143 eJwFwYEBwCAIA7CbrKXIOayT/08wia0lJxViTEyWWUCC90juPCjPNUA4usf0d0SstbP+fg//ENw= (25 Jun 2016 18:17:57 GMT)
X-Complaints-To abuse@news.solani.org
NNTP-Posting-Date Sat, 25 Jun 2016 18:17:57 +0000 (UTC)
User-Agent KNode/4.14.2
X-User-ID eJwFwQcBADAIAzBNfJDD6fxLWGLi5Bvq5mrPXo6vErW8PaweYRrHhezxA7dUIhrvTmI1K9TMnKNkl0c+jncWkA==
Cancel-Lock sha1:qh1hHNhx13yn6XfdwOo7aXq2oiI=
X-NNTP-Posting-Host eJwFwYEBwDAEBMCVKP5jHBH2H6F3YVA0HQGPjRW4GtfPxzswVnvlUvqapL7Wycco8Tn5BvIDDRIQ1w==
Xref csiph.com comp.lang.javascript:30733

Show key headers only | View raw


Janis Papanagnou wrote:

> On 25.06.2016 17:51, Michael Haufe (TNO) wrote:
>> I suggest reading a bit on this:
>> 
>> <https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent>
>> 
>> It can be "simple" if you make it so.
> 
> Hmm.. - you seem to be very stingy here with providing "simple"
> information. If it "can be so simple", would it be possible to just post
> the way to go, please?

No.  Do your own homework.

> The information on that link

Resource/document; _not_ “link”.  The (hyper)link is the *reference* to the 
resource/document instead.

> seems to suggest installing event listener for keyup/keydown […]

It does not.

> (which I wanted to avoid).

Why do you want to avoid using the keydown/keyup events?

> Or following the 'keyboardEvent()' link on the above 'keyboadEvent' link 
> suggests using a KeyboardEvent() object. My naive tries on the latter
> (yes, I don't know much of these issues; else I wouldn't ask the question
> here), e.g.
> 
>         var x = new KeyboardEvent("keypress");
>         if (x.shiftKey) {
>             alert("shift");
>         } else {
>             alert("no shift");
>         }
> 
> were ineffective, though, so more concrete input would be appreciated.

You should read more carefully.  With the above you *create* the keyboard 
event object (and can simulate keypresses by dispatching it to elements).  

You need to use the keyboard event object that the runtime environment 
creates for you, and dispatches to your event listener, instead.

<https://www.w3.org/TR/2015/REC-dom-20151119/#events>

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not cc me. / Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Interrogation of Shift-Key state Janis Papanagnou <janis_papanagnou@hotmail.com> - 2016-06-25 14:59 +0200
  Re: Interrogation of Shift-Key state Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-06-25 17:18 +0200
    Re: Interrogation of Shift-Key state Janis Papanagnou <janis_papanagnou@hotmail.com> - 2016-06-25 19:47 +0200
      Re: Interrogation of Shift-Key state Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-06-25 20:07 +0200
  Re: Interrogation of Shift-Key state "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-06-25 08:51 -0700
    Re: Interrogation of Shift-Key state Janis Papanagnou <janis_papanagnou@hotmail.com> - 2016-06-25 19:47 +0200
      Re: Interrogation of Shift-Key state Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-06-25 20:17 +0200
        Re: Interrogation of Shift-Key state Janis Papanagnou <janis_papanagnou@hotmail.com> - 2016-06-25 21:16 +0200
          Re: Interrogation of Shift-Key state Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-06-25 22:33 +0200
            Re: Interrogation of Shift-Key state Janis Papanagnou <janis_papanagnou@hotmail.com> - 2016-06-26 00:49 +0200
              Re: Interrogation of Shift-Key state Tim Streater <timstreater@greenbee.net> - 2016-06-26 00:06 +0100
              Re: Interrogation of Shift-Key state Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-06-26 11:05 +0200
      Re: Interrogation of Shift-Key state "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-06-25 12:17 -0700
        Re: Interrogation of Shift-Key state "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-06-25 12:23 -0700
        Re: Interrogation of Shift-Key state Janis Papanagnou <janis_papanagnou@hotmail.com> - 2016-06-26 00:34 +0200
        Re: Interrogation of Shift-Key state Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-18 20:29 +0200
          Re: Interrogation of Shift-Key state "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-08-18 15:17 -0700
            Re: Interrogation of Shift-Key state Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-20 07:23 +0200
              Re: Interrogation of Shift-Key state "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-08-20 00:03 -0700
                Re: Interrogation of Shift-Key state Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-20 11:48 +0200
                Re: Interrogation of Shift-Key state "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-08-25 13:39 -0700
      Re: Interrogation of Shift-Key state "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-06-25 12:20 -0700
      Re: Interrogation of Shift-Key state Tim Streater <timstreater@greenbee.net> - 2016-06-25 22:33 +0100
        Re: Interrogation of Shift-Key state Janis Papanagnou <janis_papanagnou@hotmail.com> - 2016-06-26 01:18 +0200
          Re: Interrogation of Shift-Key state Tim Streater <timstreater@greenbee.net> - 2016-06-26 00:23 +0100
            Re: Interrogation of Shift-Key state Janis Papanagnou <janis_papanagnou@hotmail.com> - 2016-06-26 01:37 +0200
              Re: Interrogation of Shift-Key state Tim Streater <timstreater@greenbee.net> - 2016-06-26 09:41 +0100
  Re: Interrogation of Shift-Key state - workaround Janis Papanagnou <janis_papanagnou@hotmail.com> - 2016-06-26 00:33 +0200
    Re: Interrogation of Shift-Key state - workaround "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-06-26 00:53 +0200
      Re: Interrogation of Shift-Key state - workaround Janis Papanagnou <janis_papanagnou@hotmail.com> - 2016-06-26 01:31 +0200
        Re: Interrogation of Shift-Key state - workaround "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-06-25 16:52 -0700
        Re: Interrogation of Shift-Key state - workaround "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-06-26 01:56 +0200
    Re: Interrogation of Shift-Key state - workaround "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-06-25 16:50 -0700
  Re: Interrogation of Shift-Key state Joao Rodrigues <jr@none.com> - 2016-06-25 20:34 -0300

csiph-web