AylaKeyCodePractice

About This Space

Test KeyCodes and pui.fieldExit() routine.


Last updated on October 19, 2021

Forked from: /scottklement/keycode/

Public Permissions:   View   Open/Fork   Run   Comment  

KeyCode Test

This is meant as a simple way to test the keyCode values produced on various devices. Since this is a publicly available site, you can easily send the link to customers for them to try it, and you can easily open it from your mobile devices (even if using a cell phone network.)

The output below the text boxes shows the keyCode and whether the shift key was pressed. So 107 false indicates that it was keyCode 107, and the shift key was not pressed. Whereas 187 true indicates that keyCode 187 was pressed, and the shift key was pressed.

Also the screen-level onkeydown event is set to the following:

if (pui.touchDevice && event.keyCode==187 && event.shiftKey==true) {
  pui.fieldExit(false);
  preventEvent(event);
}
else if (!pui.touchDevice && event.keyCode==107) {
  pui.fieldExit(false);
  preventEvent(event);
}

The pui.fieldExit function is being called on a touch device if keyCode 187 (which is the = key on the row of keys at the top of the keyboard) was pressed and the shift key was held down. We must use pui.fieldExit() for this instead of pui["field exit key"] because the latter does not allow shifted keys.

On a non-touch device, it looks for keyCode 107 (the + key on the numeric keypad at the side). In this case it would be possible to use pui["field exit key"] = 107; to do the same thing -- but, this method is a bit more flexible since we can write expressions to check for stuff like touch devices, shift keys, etc. So we may as well keep using it here, too.

Be the first to comment:      

Comments

Write Preview Markdown: bold italic code link
Post

More Spaces By Ayla (@ayla)

Filters:

Popular Recent

testing out some fun stuff!

2923

0

0

test

2083

0

0

testing

2875

0

0

Kerim's email: I found a small bug in the low-code editor for calling IBM i commands. Unfortunately, I cannot create a Profound.js spaces workspace for it since it's not possible to call IBM i commands in PJS spaces.

2503

0

0

testing his issue

2609

0

0

playing around with low-code!

2880

0

0

practice with node js

2857

0

0

how to loop through nested output parameters

2183

0

0

Automatically load data from web services into the Grid widget via server-side Node.js code on the [ initial routine ] Screen Event.

2450

0

0

working with Profound.js Spaces

2853

0

0

4/8/21

2863

0

0