浏览代码

Merge pull request #493 from tig/expanded_TimeDate_scenario

Expanded time date scenario
Charlie Kindel 5 年之前
父节点
当前提交
a4954ca8d3
共有 1 个文件被更改,包括 45 次插入11 次删除
  1. 45 11
      UICatalog/Scenarios/TimeAndDate.cs

+ 45 - 11
UICatalog/Scenarios/TimeAndDate.cs

@@ -8,22 +8,56 @@ namespace UICatalog {
 	class TimeAndDate : Scenario {
 	class TimeAndDate : Scenario {
 		public override void Setup ()
 		public override void Setup ()
 		{
 		{
-			// NOTE: The TimeField control is not ready for prime-time.
+			// NOTE: The TimeField control is not ready for prime-time. See #246
 
 
-			Win.Add (new TimeField (0, 0, DateTime.Now, isShort: false) {
+			var longTime = new TimeField (0, 0, DateTime.Now, isShort: false) {
 				// BUGBUG: TimeField does not support Computed Layout
 				// BUGBUG: TimeField does not support Computed Layout
-				//X = Pos.Center (),
-				//Y = Pos.Center () - 1,
-				X = 10,
+				X = Pos.Center (),
 				Y = 2,
 				Y = 2,
-			});
+				ReadOnly = false,
+			};
+			Win.Add (longTime);
+
+			var shortTime = new TimeField (0, 2, DateTime.Now, isShort: true) {
+				// BUGBUG: TimeField does not support Computed Layout
+				X = Pos.Center (),
+				Y = Pos.Bottom(longTime) + 1,
+				ReadOnly = true,
+			};
+			Win.Add (shortTime);
+
+			var shortDate = new DateField (0, 2, DateTime.Now, isShort: true) {
+				// BUGBUG: TimeField does not support Computed Layout
+				X = Pos.Center (),
+				Y = Pos.Bottom (shortTime) + 1,
+				ReadOnly = true,
+			};
+			Win.Add (shortDate);
 
 
-			Win.Add (new TimeField (0, 2, DateTime.Now, isShort: true) {
+			var longDate = new TimeField (0, 2, DateTime.Now, isShort: true) {
 				// BUGBUG: TimeField does not support Computed Layout
 				// BUGBUG: TimeField does not support Computed Layout
-				//X = Pos.Center (),
-				//Y = Pos.Center () + 1,
-				X = 10,
-				Y = 3,
+				X = Pos.Center (),
+				Y = Pos.Bottom (shortDate) + 1,
+				ReadOnly = true,
+			};
+			Win.Add (longDate);
+
+			Win.Add (new Button ("Swap Long/Short & Read/Read Only") {
+				X = Pos.Center (),
+				Y = Pos.Bottom (Win) - 5,
+				Clicked = () => {
+					longTime.ReadOnly = !longTime.ReadOnly;
+					shortTime.ReadOnly = !shortTime.ReadOnly;
+
+					//longTime.IsShortFormat = !longTime.IsShortFormat;
+					//shortTime.IsShortFormat = !shortTime.IsShortFormat;
+
+					longDate.ReadOnly = !longDate.ReadOnly;
+					shortDate.ReadOnly = !shortDate.ReadOnly;
+
+					//longDate.IsShortFormat = !longDate.IsShortFormat;
+					//shortDate.IsShortFormat = !shortDate.IsShortFormat;
+				}
 			});
 			});
 		}
 		}
 	}
 	}