Revision: 4668
          http://sourceforge.net/p/vexi/code/4668
Author:   mkpg2
Date:     2014-03-03 20:30:17 +0000 (Mon, 03 Mar 2014)
Log Message:
-----------
Improve. Timefield. Increment minutes not hours by default.

Modified Paths:
--------------
    
branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/timefield.t

Modified: 
branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/timefield.t
===================================================================
--- 
branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/timefield.t
    2014-02-28 01:33:19 UTC (rev 4667)
+++ 
branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/timefield.t
    2014-03-03 20:30:17 UTC (rev 4668)
@@ -90,7 +90,7 @@
         ////////
         // button actions
         
-        thisbox.selected = $hours;
+        thisbox.selected; //= $hours;
         thisbox.focused ++= .timefield..focusWrite;
         thisbox.selected ++= .timefield..selectWrite;
         
@@ -119,46 +119,61 @@
         
         thisbox.minsIncrement = 1;
         
-        $more.action ++= function(v) {
+        const incrementTrap = function(v){
             if (hours==null or mins==null) {
                 setDefault();             
-            } else if (selected == $period) {
-                if (12>hours) {
-                    hours += 12;
+            } else {
+                var part;
+                if(selected?.selected){
+                    part = selected;
+                }else{
+                    part = selected = $mins;
                 }
-            } else if (selected == $hours) {
-                if(loop!=false || 23>hours){
-                    hours = hours+1;
+                
+                const more = trapee==$more;
+                
+                if (part == $period) {
+                    if(more){
+                           if (12>hours) {
+                               hours += 12;
+                           }
+                    }else{
+                        if (hours>11) {
+                                   hours -= 12;
+                               }
+                    }
+                } else if (part == $hours) {
+                    if(more){
+                           if(loop!=false || 23>hours){
+                               hours = hours+1;
+                           }
+                    }else{
+                        if(loop!=false || hours>0){
+                                   hours = hours-1;
+                               }
+                    
+                    }
+                } else if (part == $mins) {
+                    if(more){
+                           if(loop!=false || ((60-minsIncrement)>mins || 
23>hours)){
+                               mins = mins+minsIncrement;
+                           }
+                    }else{
+                        if(loop!=false || hours>0 || mins>=minsIncrement){
+                                   mins = mins-minsIncrement;
+                               }
+                    }
                 }
-            } else if (selected == $mins) {
-                if(loop!=false || ((60-minsIncrement)>mins || 23>hours)){
-                    mins = mins+minsIncrement;
-                }
             }
             value = value;
             return;
-        }
         
-        $less.action ++= function(v) {
-            if (hours==null or mins==null) {
-                setDefault();
-            } else if (selected == $period) {
-                if (hours>11) {
-                    hours -= 12;
-                }
-            } else if (selected == $hours) {
-                if(loop!=false || hours>0){
-                    hours = hours-1;
-                }
-            } else if (selected == $mins) {
-                if(loop!=false || hours>0 || mins>=minsIncrement){
-                    mins = mins-minsIncrement;
-                }
-            }
-            value = value;
-            return;
-        }
+        };
         
+        $more.action ++= incrementTrap;
+        
+        $less.action ++= incrementTrap;
+        
         ////////
         // keyboard interaction
         

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to