picolisp

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/picolisp.git/
Log | Files | Refs | README | LICENSE

commit dc80fec030164d19f35d0889e6995825dd20f102
parent 7427c13e7d1eeb6e08acc8b86db2f309f387a7bd
Author: Alexander Burger <abu@software-lab.de>
Date:   Mon, 28 Nov 2011 19:09:03 +0100

Up, down and enter keys in hints
Diffstat:
Mlib/form.js | 38+++++++++++++++++++++++---------------
1 file changed, 23 insertions(+), 15 deletions(-)

diff --git a/lib/form.js b/lib/form.js @@ -319,7 +319,7 @@ function doHint(field) { } function hintKey(field, event, tok, coy) { - var i, data, lst; + var i, data; if (!HintReq) return true; @@ -333,10 +333,8 @@ function hintKey(field, event, tok, coy) { if (Hint.style.visibility == "hidden") return true; if (Item > 0) { - (lst = Hints.childNodes)[Item].style.background = "white"; - lst[Item].style.color= "black"; - lst[--Item].style.background = "black"; - lst[Item].style.color= "white"; + hintOff(Item); + hintOn(--Item); } return false; } @@ -344,12 +342,9 @@ function hintKey(field, event, tok, coy) { if (Hint.style.visibility == "hidden") return true; if (Item < (lst = Hints.childNodes).length-1) { - if (Item >= 0) { - lst[Item].style.background = "white"; - lst[Item].style.color= "black"; - } - lst[++Item].style.background = "black"; - lst[Item].style.color= "white"; + if (Item >= 0) + hintOff(Item); + hintOn(++Item); } return false; } @@ -394,6 +389,7 @@ function hintKey(field, event, tok, coy) { Hints.style.width = n + 3 + "ex"; Hint.style.width = n + 4 + "ex"; Hint.style.visibility = "visible"; + Item = -1; } } } @@ -414,14 +410,14 @@ function addHint(i, field, str) { var item = document.createElement("div"); item.appendChild(document.createTextNode(str)); item.onmouseover = function() { - this.style.background = "black"; - this.style.color= "white"; + if (Item >= 0) + hintOff(Item); + hintOn(i); field.onchange = false; Item = i; } item.onmouseout = function() { - this.style.background = "white"; - this.style.color= "black"; + hintOff(Item); field.onchange = function() { return fldChg(field, item); }; @@ -444,3 +440,15 @@ function setHint(field, item) { }; Item = -1; } + +function hintOn(i) { + var s = Hints.childNodes[i].style; + s.background = "black"; + s.color= "white"; +} + +function hintOff(i) { + var s = Hints.childNodes[i].style; + s.background = "white"; + s.color= "black"; +}