ecere: DateBox/CalendarControl useability: Editing date from keyboard; Moved SavingDa...
authorJerome St-Louis <jerome@ecere.com>
Thu, 18 Aug 2011 09:27:58 +0000 (05:27 -0400)
committerJerome St-Louis <jerome@ecere.com>
Thu, 18 Aug 2011 09:27:58 +0000 (05:27 -0400)
ecere/src/gui/controls/CalendarControl.ec
ecere/src/gui/controls/DataBox.ec
ecere/src/gui/controls/TabControl.ec
ecere/src/sys/Date.ec

index 93a3473..b78694d 100644 (file)
@@ -296,7 +296,13 @@ private:
          case down:
             if(dateBox.active)
             {
-               if(key == left) dateValue.day--;
+               if(shownMonth != dateValue.month || shownYear != dateValue.year)
+               {
+                  dateValue.month = shownMonth;
+                  dateValue.year = shownYear;
+                  dateValue.day = 1;
+               }
+               else if(key == left) dateValue.day--;
                else if(key == right) dateValue.day++;
                else if(key == up) dateValue.day-=7;
                else if(key == down) dateValue.day+=7;
index d7d2082..dd0c751 100644 (file)
@@ -155,3 +155,27 @@ private:
       return editor ? editor.OnKeyDown(key, ch) : true;
    }
 };
+
+public class SavingDataBox : DataBox
+{
+   borderStyle = deep;
+   bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
+   {
+      if(!active)
+      {
+         if(!SaveData())
+            Refresh();
+      }
+      return true;
+   }
+
+   bool OnKeyDown(Key key, unichar ch)
+   {
+      if((SmartKey)key == enter)
+      {
+         SaveData();
+         return true;
+      }
+      return DataBox::OnKeyDown(key, ch);
+   }
+}
index 18745e2..0a97775 100644 (file)
@@ -736,27 +736,3 @@ public class Tab : Window
          button.text = text;
    };
 }
-
-public class SavingDataBox : DataBox
-{
-   borderStyle = deep;
-   bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
-   {
-      if(!active)
-      {
-         if(!SaveData())
-            Refresh();
-      }
-      return true;
-   }
-
-   bool OnKeyDown(Key key, unichar ch)
-   {
-      if((SmartKey)key == enter)
-      {
-         SaveData();
-         return true;
-      }
-      return DataBox::OnKeyDown(key, ch);
-   }
-}
index 87f4d90..93ba12e 100644 (file)
@@ -266,6 +266,7 @@ public struct Date
          editText = true;
          anchor = { 0, 0, 0, 0 };
          borderStyle = 0;
+         hotKey = f2;
       };
       
       if(day || year || month)