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


Groups > comp.lang.javascript > #10100 > unrolled thread

detect if user can generate key events ?

Started byPeter Billam <peter@www.pjb.com.au>
First post2012-01-10 09:08 +0000
Last post2012-01-10 05:30 -0800
Articles 6 — 4 participants

Back to article view | Back to comp.lang.javascript


Contents

  detect if user can generate key events ? Peter Billam <peter@www.pjb.com.au> - 2012-01-10 09:08 +0000
    Re: detect if user can generate key events ? "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2012-01-10 11:35 +0200
      Re: detect if user can generate key events ? Peter Billam <peter@www.pjb.com.au> - 2012-01-10 11:25 +0000
        Re: detect if user can generate key events ? "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2012-01-10 13:47 +0200
      Re: detect if user can generate key events ? Swifty <steve.j.swift@gmail.com> - 2012-01-10 12:33 +0000
        Re: detect if user can generate key events ? Captain Paralytic <paul_lautman@yahoo.com> - 2012-01-10 05:30 -0800

#10100 — detect if user can generate key events ?

FromPeter Billam <peter@www.pjb.com.au>
Date2012-01-10 09:08 +0000
Subjectdetect if user can generate key events ?
Message-ID<slrnjgo00f.2de.peter@box8.pjb.com.au>
Greetings;  hope this makes sense:

I've got this page:
  http://www.pjb.com.au/esperanto/eo_en.html:
which handles onkeydown events.  On a friends iphone and opera,
the qwerty kbd app isn't being evoked by any entry field
and apparently couldn't be started up by the user,
and so the user can't generate any keyboard events.

Therefore, I'd like to detect whether the user
is able to generate kbd events, and if not then offer
a different user-interface using text-entry fields.

Is there a way to detect if the user can generate kbd events ?

Peter

-- 
Peter Billam    www.pjb.com.au    www.pjb.com.au/comp/contact.html

[toc] | [next] | [standalone]


#10102

From"Jukka K. Korpela" <jkorpela@cs.tut.fi>
Date2012-01-10 11:35 +0200
Message-ID<jeh0pu$4uu$1@dont-email.me>
In reply to#10100
2012-01-10 11:08, Peter Billam wrote:

> I've got this page:
>    http://www.pjb.com.au/esperanto/eo_en.html:
> which handles onkeydown events.

I don’t quite see why. It seems to read some input and run a lookup on 
it, then write the match, if any. There does not seem to be any 
immediate visible effect when the circumflex ^ is used, so I don’t see 
why you don't act on just on Enter and perform string manipulation on 
the input. And if you do the normal thing of using a text input box, 
users can also use cut and paste.

The page uses one of the old methods of writing Esperanto in Ascii only, 
the “x notation.” As implemented, the logic of the page means that even 
though I can normally perfectly well write Esperanto as such, using e.g. 
c with circumflex (ĉ), on this page it won’t work, because I use a dead 
key to add a circumflex on a letter. (That’s usual when using European 
keyboards, though most of them can handle just a small number of 
diacritic + letter combinations.)

> Is there a way to detect if the user can generate kbd events ?

Hardly. How could JavaScript detect whether I just poured coffee over my 
keyboard so that it stopped working and I need to use the mouse now? 
(This is not [only] a joke; programmed tests on possibilities of doing 
something are inherently limited and can only test some technical aspects.)

-- 
Yucca, http://www.cs.tut.fi/~jkorpela/

[toc] | [prev] | [next] | [standalone]


#10103

FromPeter Billam <peter@www.pjb.com.au>
Date2012-01-10 11:25 +0000
Message-ID<slrnjgo81g.2sa.peter@box8.pjb.com.au>
In reply to#10102
On 2012-01-10, Jukka K. Korpela <jkorpela@cs.tut.fi> wrote:
> 2012-01-10 11:08, Peter Billam wrote:
>> I've got this page:
>>    http://www.pjb.com.au/esperanto/eo_en.html:
>> which handles onkeydown events.
>
> I don’t quite see why. It seems to read some input and run a lookup
> on it, then write the match, if any. There does not seem to be any 
> immediate visible effect when the circumflex ^ is used, so I don’t
> see why you don't act on just on Enter and perform string
> manipulation on the input.

I wanted to leave myself the option of reacting to partial lines,
or only to certain characters, and also to learn about kbd events,
to implement an imitation vi etc.

> And if you do the normal thing of using a text input box, 
> users can also use cut and paste.

Agreed.  I'd hoped to be able to handle paste events, but no.
(I also want the previous search results to remain on the
screen as they do, but that's not hard to arrange.)
The command-line version can handle cut and paste and accents,
  http://www.pjb.com.au/esperanto/index.html
and it actually gets more downloads than the html version gets hits.

> The page uses one of the old methods of writing Esperanto in Ascii
> only, the “x notation.” As implemented, the logic of the page means
> that even though I can normally perfectly well write Esperanto as
> such, using e.g.  c with circumflex (ĉ), on this page it won’t work,

Indeed, and it's a big issue with cut and paste where you
don't have the freedom to type.  Of course if the page handled
diacriticals I'd still want to respect the x notation;
it's very ergonomic on non-esperanto keyboards.

Regards,  Peter

-- 
Peter Billam    www.pjb.com.au    www.pjb.com.au/comp/contact.html

[toc] | [prev] | [next] | [standalone]


#10104

From"Jukka K. Korpela" <jkorpela@cs.tut.fi>
Date2012-01-10 13:47 +0200
Message-ID<jeh8g3$9qb$1@dont-email.me>
In reply to#10103
2012-01-10 13:25, Peter Billam wrote:

> I wanted to leave myself the option of reacting to partial lines,
> or only to certain characters, and also to learn about kbd events,
> to implement an imitation vi etc.

Learning is fine, but KISS (Keep it simple, sir!) rules when you wish to 
produce something that others can use.

>> The page uses one of the old methods of writing Esperanto in Ascii
>> only, the “x notation.” As implemented, the logic of the page means
>> that even though I can normally perfectly well write Esperanto as
>> such, using e.g.  c with circumflex (ĉ), on this page it won’t work,
>
> Indeed, and it's a big issue with cut and paste where you
> don't have the freedom to type.

This point of mine was not about cut and paste; it was about keyboard 
input that uses dead keys. Acting on key presses can be useful in some 
contexts, but it should not prevent the user from typing normally.

> Of course if the page handled
> diacriticals I'd still want to respect the x notation;
> it's very ergonomic on non-esperanto keyboards.

You could still handle both the “x notation” and the “h notation,” if 
you used just a text input field and performed simple string 
manipulation (actually, just simple replacements) on it. Accepting cx or 
ch for ĉ should not mess things up when the user actually types ĉ.

Technically, you could effectively turn “x” to an equivalent of a dead 
key (e.g., when the user types “x” after “c,” the “c” turns to “ĉ” 
immediately), but I think this would fall into the category of 
outsmarting oneself. A less intrusive way would be to add small buttons 
for writing characters like “ĉ”, which is fairly simple, cf. to the 
Turkish input gadget at
http://bytelevelbooks.com/code/javascript/turkish-input.html

I’m not saying that such buttons have high usability; I’m saying that 
they hardly disturb anyone, and they offer an intuitively obvious way of 
entering special characters that might be needed in a specific context.

-- 
Yucca, http://www.cs.tut.fi/~jkorpela/

[toc] | [prev] | [next] | [standalone]


#10105

FromSwifty <steve.j.swift@gmail.com>
Date2012-01-10 12:33 +0000
Message-ID<qtbog79ik5nghu2eq6bocagok8g57a80ma@4ax.com>
In reply to#10102
On Tue, 10 Jan 2012 11:35:58 +0200, "Jukka K. Korpela"
<jkorpela@cs.tut.fi> wrote:

>Hardly. How could JavaScript detect whether I just poured coffee over my 
>keyboard so that it stopped working and I need to use the mouse now? 

I've come across applications that said: "If you have a keyboard,
press "Y"; otherwise press "N". :-)

-- 
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk

[toc] | [prev] | [next] | [standalone]


#10106

FromCaptain Paralytic <paul_lautman@yahoo.com>
Date2012-01-10 05:30 -0800
Message-ID<c718b8b7-b1a9-4ee1-b20d-c72926214ba4@p42g2000vbt.googlegroups.com>
In reply to#10105
On Jan 10, 12:33 pm, Swifty <steve.j.sw...@gmail.com> wrote:
> On Tue, 10 Jan 2012 11:35:58 +0200, "Jukka K. Korpela"
>
> <jkorp...@cs.tut.fi> wrote:
> >Hardly. How could JavaScript detect whether I just poured coffee over my
> >keyboard so that it stopped working and I need to use the mouse now?
>
> I've come across applications that said: "If you have a keyboard,
> press "Y"; otherwise press "N". :-)
>
"No keyboard detected during startup - Press F1 to continue"

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web