Revision: 4877 http://sourceforge.net/p/vexi/code/4877 Author: mkpg2 Date: 2016-07-21 12:02:46 +0000 (Thu, 21 Jul 2016) Log Message: ----------- Fix regression. Numfield also needs to use keytped event.
Modified Paths: -------------- branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/numfield.t Modified: branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/numfield.t =================================================================== --- branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/numfield.t 2016-07-20 22:43:08 UTC (rev 4876) +++ branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/numfield.t 2016-07-21 12:02:46 UTC (rev 4877) @@ -24,6 +24,7 @@ thisbox.minDP; thisbox.maxDP; + KeyTyped ++= static.keytypedEvent; KeyPressed ++= static.keypressEvent; scale ++= static.scale; maxvalue ++= static.limitvalueWrite; @@ -100,12 +101,10 @@ cascade = v; } - /** fire action or filter key in case of password fields */ - static.keypressEvent = function(v) { + static.keytypedEvent = function(v) { var t = trapee; var e = t.v_edit; var txt0 = e.text; - switch (v) { // Handle '-' specially. Toggles sign. case '-': { @@ -120,14 +119,6 @@ e.setCursorCharIndex(cpos); return; } - case "ENTER": - case "enter": { - var cpos = e.getCursorCharIndex(); - t.value = t.text2decimal(e.text); - cpos = vexi.math.max(e.text.length, cpos); - e.setCursorCharIndex(cpos); - return; - } case ".": { if(t.scale==null || t.scale>0){ var cpos = e.getCursorCharIndex(); @@ -140,6 +131,34 @@ } return; } + case "0": case "1": case "2": case "3": case "4": + case "5": case "6": case "7": case "8": case "9": + // Due to possibility of selection, not just editing a single char + // let the text widget handle this and correct as necessary + cascade = v; + + if (trapee.updateValueonKeyPressed) { + // trigger value setting + trapee.v_edit.text = trapee.v_edit.text; + } + } + }; + + /** fire action or filter key in case of password fields */ + static.keypressEvent = function(v) { + var t = trapee; + var e = t.v_edit; + var txt0 = e.text; + + switch (v) { + case "ENTER": + case "enter": { + var cpos = e.getCursorCharIndex(); + t.value = t.text2decimal(e.text); + cpos = vexi.math.max(e.text.length, cpos); + e.setCursorCharIndex(cpos); + return; + } case "C-a": case "C-x": case "C-v": case "LEFT": case "RIGHT": case "UP": case "DOWN": case "left": case "right": case "up": case "down": @@ -147,9 +166,6 @@ case "home": case "end": case "BACK_SPACE": case "DELETE": case "back_space": case "delete": - - case "0": case "1": case "2": case "3": case "4": - case "5": case "6": case "7": case "8": case "9": // Due to possibility of selection, not just editing a single char // let the text widget handle this and correct as necessary cascade = v; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports.http://sdm.link/zohodev2dev _______________________________________________ Vexi-svn mailing list Vexi-svn@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/vexi-svn