Browse Source

Updated MessageBoxes and Dialogs Scenarios to use AutoSize

Tig Kindel 1 year ago
parent
commit
bbb84f812e
2 changed files with 3 additions and 33 deletions
  1. 1 14
      UICatalog/Scenarios/Dialogs.cs
  2. 2 19
      UICatalog/Scenarios/MessageBoxes.cs

+ 1 - 14
UICatalog/Scenarios/Dialogs.cs

@@ -15,6 +15,7 @@ namespace UICatalog.Scenarios {
 				X = Pos.Center (),
 				Y = 1,
 				Width = Dim.Percent (75),
+				Height = Dim.AutoSize ()
 			};
 
 			var label = new Label ("Width:") {
@@ -114,20 +115,6 @@ namespace UICatalog.Scenarios {
 			};
 			frame.Add (styleRadioGroup);
 
-			frame.ForceValidatePosDim = true;
-			void Top_Loaded (object sender, EventArgs args)
-			{
-				frame.Height =
-					widthEdit.Frame.Height +
-					heightEdit.Frame.Height +
-					titleEdit.Frame.Height +
-					numButtonsEdit.Frame.Height +
-					glyphsNotWords.Frame.Height +
-					styleRadioGroup.Frame.Height;
-				Application.Top.Loaded -= Top_Loaded;
-			}
-			Application.Top.Loaded += Top_Loaded;
-
 			Win.Add (frame);
 
 			label = new Label ("Button Pressed:") {

+ 2 - 19
UICatalog/Scenarios/MessageBoxes.cs

@@ -14,7 +14,7 @@ namespace UICatalog.Scenarios {
 				X = Pos.Center (),
 				Y = 1,
 				Width = Dim.Percent (75),
-				Height = 12
+				Height = Dim.AutoSize ()
 			};
 			Win.Add (frame);
 
@@ -145,24 +145,7 @@ namespace UICatalog.Scenarios {
 				Y = Pos.Top (label) + 3
 			};
 			frame.Add (ckbWrapMessage);
-
-			frame.ForceValidatePosDim = true;
-			void Top_Loaded (object sender, EventArgs args)
-			{
-				frame.Height =
-					widthEdit.Frame.Height +
-					heightEdit.Frame.Height +
-					titleEdit.Frame.Height +
-					messageEdit.Frame.Height +
-					numButtonsEdit.Frame.Height +
-					defaultButtonEdit.Frame.Height +
-					styleRadioGroup.Frame.Height +
-					2 +
-					ckbWrapMessage.Frame.Height;
-				Application.Top.Loaded -= Top_Loaded;
-			}
-			//Application.Top.Loaded += Top_Loaded;
-
+		
 			label = new Label ("Button Pressed:") {
 				X = Pos.Center (),
 				Y = Pos.Bottom (frame) + 4,