Browse Source

Improve sample

Miguel de Icaza 7 years ago
parent
commit
dbd1ae0562
2 changed files with 25 additions and 7 deletions
  1. 24 6
      StandaloneExample/Program.cs
  2. 1 1
      StandaloneExample/StandaloneExample.csproj

+ 24 - 6
StandaloneExample/Program.cs

@@ -92,14 +92,32 @@ class Demo {
 
 		Application.MainLoop.AddTimeout (TimeSpan.FromMilliseconds (300), timer);
 
+		// A little convoluted, this is because I am using this to test the
+		// layout based on referencing elements of another view:
+
+		var login = new Label ("Login: ") { X = 3, Y = 6 };
+		var password = new Label ("Password: ") {
+			X = Pos.Left (login),
+			Y = Pos.Bottom (login) + 1
+		};
+		var loginText = new TextField ("") {
+			X = Pos.Right (password),
+			Y = Pos.Top (login),
+			Width = 40
+		};
+		var passText = new TextField ("") {
+			Secret = true,
+			X = Pos.Left (loginText),
+			Y = Pos.Top (password),
+			Width = Dim.Width (loginText)
+		};
+		
 		// Add some content
 		container.Add (
-			//new Label (3, 6, "Login: "),
-			//new TextField (14, 6, 40, ""),
-			new Label ("Login: ") { X = 3, Y = 6 },
-			new TextField ("") { X = 14, Y = 6, Width = 40 },
-			new Label ("Password: ") { X = 3, Y = 8 },
-			new TextField ("") { X = 14, Y = 18, Width = 40, Secret = true },
+			login,
+			loginText,
+			password,
+			passText,
 			new FrameView (new Rect (3, 10, 25, 6), "Options"){
 				new CheckBox (1, 0, "Remember me"),
 				new RadioGroup (1, 2, new [] { "_Personal", "_Company" }),

+ 1 - 1
StandaloneExample/StandaloneExample.csproj

@@ -7,6 +7,6 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="Terminal.Gui" Version="0.8.0" />
+    <PackageReference Include="Terminal.Gui" Version="0.12.0" />
   </ItemGroup>
 </Project>