joe tes keycode

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

Filters:

Popular Recent

A simple demo for CRUD app

834

0

0

This is a test app

737

0

0

Test Hello World

435

0

0

781

0

0