|
@@ -18,8 +18,8 @@ The *Terminal.Gui* toolkit contains various controls for building text user inte
|
|
* [CheckBox](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.CheckBox.html)
|
|
* [CheckBox](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.CheckBox.html)
|
|
* [ComboBox](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.ComboBox.html)
|
|
* [ComboBox](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.ComboBox.html)
|
|
* [Dialog](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.Dialog.html)
|
|
* [Dialog](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.Dialog.html)
|
|
- * [OpenDialog](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.OpenDialog.html)
|
|
|
|
- * [SaveDialog](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.SaveDialog.html)
|
|
|
|
|
|
+ * [OpenDialog](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.OpenDialog.html)
|
|
|
|
+ * [SaveDialog](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.SaveDialog.html)
|
|
* [FrameView](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.FrameView.html)
|
|
* [FrameView](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.FrameView.html)
|
|
* [Hex viewer/editor](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.HexView.html)
|
|
* [Hex viewer/editor](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.HexView.html)
|
|
* [Label](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.Label.html)
|
|
* [Label](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui/Terminal.Gui.Label.html)
|
|
@@ -94,68 +94,68 @@ Debates on architecture and design can be found in Issues tagged with [design](h
|
|
using Terminal.Gui;
|
|
using Terminal.Gui;
|
|
|
|
|
|
class Demo {
|
|
class Demo {
|
|
- static void Main ()
|
|
|
|
- {
|
|
|
|
- Application.Init ();
|
|
|
|
- var top = Application.Top;
|
|
|
|
|
|
+ static void Main ()
|
|
|
|
+ {
|
|
|
|
+ Application.Init ();
|
|
|
|
+ var top = Application.Top;
|
|
|
|
|
|
// Creates the top-level window to show
|
|
// Creates the top-level window to show
|
|
- var win = new Window ("MyApp") {
|
|
|
|
- X = 0,
|
|
|
|
- Y = 1, // Leave one row for the toplevel menu
|
|
|
|
|
|
+ var win = new Window ("MyApp") {
|
|
|
|
+ X = 0,
|
|
|
|
+ Y = 1, // Leave one row for the toplevel menu
|
|
|
|
|
|
- // By using Dim.Fill(), it will automatically resize without manual intervention
|
|
|
|
- Width = Dim.Fill (),
|
|
|
|
- Height = Dim.Fill ()
|
|
|
|
|
|
+ // By using Dim.Fill(), it will automatically resize without manual intervention
|
|
|
|
+ Width = Dim.Fill (),
|
|
|
|
+ Height = Dim.Fill ()
|
|
};
|
|
};
|
|
- top.Add (win);
|
|
|
|
|
|
+ top.Add (win);
|
|
|
|
|
|
// Creates a menubar, the item "New" has a help menu.
|
|
// Creates a menubar, the item "New" has a help menu.
|
|
- var menu = new MenuBar (new MenuBarItem [] {
|
|
|
|
- new MenuBarItem ("_File", new MenuItem [] {
|
|
|
|
- new MenuItem ("_New", "Creates new file", NewFile),
|
|
|
|
- new MenuItem ("_Close", "", () => Close ()),
|
|
|
|
- new MenuItem ("_Quit", "", () => { if (Quit ()) top.Running = false; })
|
|
|
|
- }),
|
|
|
|
- new MenuBarItem ("_Edit", new MenuItem [] {
|
|
|
|
- new MenuItem ("_Copy", "", null),
|
|
|
|
- new MenuItem ("C_ut", "", null),
|
|
|
|
- new MenuItem ("_Paste", "", null)
|
|
|
|
- })
|
|
|
|
- });
|
|
|
|
- top.Add (menu);
|
|
|
|
|
|
+ var menu = new MenuBar (new MenuBarItem [] {
|
|
|
|
+ new MenuBarItem ("_File", new MenuItem [] {
|
|
|
|
+ new MenuItem ("_New", "Creates new file", NewFile),
|
|
|
|
+ new MenuItem ("_Close", "", () => Close ()),
|
|
|
|
+ new MenuItem ("_Quit", "", () => { if (Quit ()) top.Running = false; })
|
|
|
|
+ }),
|
|
|
|
+ new MenuBarItem ("_Edit", new MenuItem [] {
|
|
|
|
+ new MenuItem ("_Copy", "", null),
|
|
|
|
+ new MenuItem ("C_ut", "", null),
|
|
|
|
+ new MenuItem ("_Paste", "", null)
|
|
|
|
+ })
|
|
|
|
+ });
|
|
|
|
+ top.Add (menu);
|
|
|
|
|
|
var login = new Label ("Login: ") { X = 3, Y = 2 };
|
|
var login = new Label ("Login: ") { X = 3, Y = 2 };
|
|
var password = new Label ("Password: ") {
|
|
var password = new Label ("Password: ") {
|
|
- X = Pos.Left (login),
|
|
|
|
|
|
+ X = Pos.Left (login),
|
|
Y = Pos.Top (login) + 1
|
|
Y = Pos.Top (login) + 1
|
|
- };
|
|
|
|
|
|
+ };
|
|
var loginText = new TextField ("") {
|
|
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)
|
|
|
|
- };
|
|
|
|
|
|
+ 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 controls,
|
|
// Add some controls,
|
|
win.Add (
|
|
win.Add (
|
|
- // The ones with my favorite layout system
|
|
|
|
- login, password, loginText, passText,
|
|
|
|
-
|
|
|
|
- // The ones laid out like an australopithecus, with absolute positions:
|
|
|
|
- new CheckBox (3, 6, "Remember me"),
|
|
|
|
- new RadioGroup (3, 8, new [] { "_Personal", "_Company" }),
|
|
|
|
- new Button (3, 14, "Ok"),
|
|
|
|
- new Button (10, 14, "Cancel"),
|
|
|
|
- new Label (3, 18, "Press F9 or ESC plus 9 to activate the menubar"));
|
|
|
|
-
|
|
|
|
- Application.Run ();
|
|
|
|
- }
|
|
|
|
|
|
+ // The ones with my favorite layout system
|
|
|
|
+ login, password, loginText, passText,
|
|
|
|
+
|
|
|
|
+ // The ones laid out like an australopithecus, with absolute positions:
|
|
|
|
+ new CheckBox (3, 6, "Remember me"),
|
|
|
|
+ new RadioGroup (3, 8, new [] { "_Personal", "_Company" }),
|
|
|
|
+ new Button (3, 14, "Ok"),
|
|
|
|
+ new Button (10, 14, "Cancel"),
|
|
|
|
+ new Label (3, 18, "Press F9 or ESC plus 9 to activate the menubar"));
|
|
|
|
+
|
|
|
|
+ Application.Run ();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
```
|
|
```
|
|
|
|
|
|
@@ -165,10 +165,10 @@ Alternatively, you can encapsulate the app behavior in a new `Window`-derived cl
|
|
using Terminal.Gui;
|
|
using Terminal.Gui;
|
|
|
|
|
|
class Demo {
|
|
class Demo {
|
|
- static void Main ()
|
|
|
|
- {
|
|
|
|
- Application.Run<App> ();
|
|
|
|
- }
|
|
|
|
|
|
+ static void Main ()
|
|
|
|
+ {
|
|
|
|
+ Application.Run<App> ();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
```
|
|
```
|
|
|
|
|