Revision: 4545
          http://sourceforge.net/p/vexi/code/4545
Author:   mkpg2
Date:     2013-08-30 14:07:01 +0000 (Fri, 30 Aug 2013)
Log Message:
-----------
Timefield widget.
- loop property. Set to false to not loop back to start/finish when changing 
mins and hours.
- default property. Sets a default initial value.

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

Added Paths:
-----------
    branches/vexi3/org.vexi-vexi.widgets/src_poke/poke/widgets/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
    2013-08-30 13:42:46 UTC (rev 4544)
+++ 
branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/timefield.t
    2013-08-30 14:07:01 UTC (rev 4545)
@@ -95,7 +95,8 @@
         thisbox.focused ++= .timefield..focusWrite;
         thisbox.selected ++= .timefield..selectWrite;
         
-        var selectPart = function(v) {
+        
+        const selectPart = function(v) {
             selected = trapee;
             cascade = v;;
         }
@@ -104,22 +105,35 @@
         $mins.Press1   ++= selectPart;
         $period.Press1 ++= selectPart;
         
-        $more.action ++= function(v) {
-            if (hours==null or mins==null) {
+        const setDefault = function(){
+            if(hours==null and mins==null){
+                value = thisbox["default"]?:"now";
+            }else{
                 if (hours==null) {
                     hours = 0;
                 }
                 if (mins==null) {
                     mins = 0;
                 }
+            }
+        }; 
+        
+        
+        $more.action ++= function(v) {
+            if (hours==null or mins==null) {
+                setDefault();             
             } else if (selected == $period) {
                 if (12>hours) {
                     hours += 12;
                 }
             } else if (selected == $hours) {
-                hours = hours+1;
+                if(loop!=false || 23>hours){
+                    hours = hours+1;
+                }
             } else if (selected == $mins) {
-                mins = mins+1;
+                if(loop!=false || (59>mins || 23>hours)){
+                    mins = mins+1;
+                }
             }
             value = value;
             return;
@@ -127,23 +141,19 @@
         
         $less.action ++= function(v) {
             if (hours==null or mins==null) {
-                if (hours==null) {
-                    hours = 0;
-                }
-                if (mins==null) {
-                    mins = 0;
-                }
+                setDefault();
             } else if (selected == $period) {
                 if (hours>11) {
                     hours -= 12;
                 }
             } else if (selected == $hours) {
-                hours = hours==null ? 23 : hours-1;
+                if(loop!=false || hours>0){
+                    hours = hours-1;
+                }
             } else if (selected == $mins) {
-                if (hours == null) {
-                    hours = 23;
+                if(loop!=false || hours>0 || mins>0){
+                    mins = mins-1;
                 }
-                mins = mins==null ? 59 : mins-1;
             }
             value = value;
             return;
@@ -232,7 +242,7 @@
                     break;
                 case "enter":
                     if (value==null) {
-                        value = "now";
+                        value = thisbox["default"]?:"now";
                     }
                     break;
                 case "back_space":

Added: branches/vexi3/org.vexi-vexi.widgets/src_poke/poke/widgets/timefield.t
===================================================================
--- branches/vexi3/org.vexi-vexi.widgets/src_poke/poke/widgets/timefield.t      
                        (rev 0)
+++ branches/vexi3/org.vexi-vexi.widgets/src_poke/poke/widgets/timefield.t      
2013-08-30 14:07:01 UTC (rev 4545)
@@ -0,0 +1,13 @@
+<!-- public domain -->
+
+<vexi xmlns:ui="vexi://ui" xmlns:w="vexi.widget">
+    <w:surface />
+    <ui:box orient="vertical">
+        <w:timefield id="time1" />
+        <w:timefield id="time2" default="00:00" loop="false"/>
+        <w:timefield id="time3" default="23:59" loop="false"/>
+        
+        vexi.ui.frame = thisbox;
+        
+    </ui:box>
+</vexi>
\ No newline at end of file

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


------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&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