From d2ed8f4eaa589894df41b3d540d225406d30afdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Tue, 14 Jan 2003 13:01:02 +0000 Subject: [PATCH] jumping cursor using Keyboard --- ChangeLog | 2 +- libraries/functions.js | 36 ++++++++++++++++++++++++++++++++++++ tbl_properties.inc.php3 | 21 ++++++++++++++------- 3 files changed, 51 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2d16238ee..5016525eb 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,7 +5,7 @@ phpMyAdmin - Changelog $Id$ $Source$ -2003-01-14444chal Cihar +2003-01-14 Michal Cihar * tbl_properties_structure.php3,libraries/functions.js: Added (un)check all for fields selection. diff --git a/libraries/functions.js b/libraries/functions.js index 16be3af74..544b75150 100644 --- a/libraries/functions.js +++ b/libraries/functions.js @@ -478,3 +478,39 @@ function setSelectOptions(the_form, the_select, do_check) return true; } // end of the 'setSelectOptions()' function + +/** + * Allows moving around inputs/select by Ctrl+arrows + * + * @param object event data + */ +function onKeyDownArrowsHandler(e) { + e=e||window.event; + var o = (e.srcElement||e.target); + if (!o) return; + if (o.tagName != "INPUT" && o.tagName != "SELECT") return; + if (!e.ctrlKey) return; + if (!o.id) return; + + var pos = o.id.split("_"); + if (pos[0] != "field" || typeof pos[2] == "undefined") return; + + var x = pos[2], y=pos[1]; + + switch(e.keyCode) { + case 38: y--; break; // up + case 40: y++; break; // down + case 37: x--; break; // left + case 39: x++; break; // right + default: return; + } + + var id = "field_" + y + "_" + x; + var nO = document.getElementById(id); + if (!nO) return; + nO.focus(); + if (nO.tagName != 'SELECT') { + nO.select(); + } + e.returnValue = false; +} diff --git a/tbl_properties.inc.php3 b/tbl_properties.inc.php3 index 61550f570..e1b157991 100755 --- a/tbl_properties.inc.php3 +++ b/tbl_properties.inc.php3 @@ -4,6 +4,13 @@ ?> + + +
- " class="textfield" /> + " class="textfield" /> - - " class="textfield" /> + " class="textfield" /> - - - " class="textfield" /> + " class="textfield" /> -