终端 GUI 表单设计器 (又名 gui.cs)
Cross platform designer for Terminal.Gui applications.
Built with CodeDom and Roslyn, TerminalGuiDesigner lets you create complicated Views with drag and drop just like the WinForms designer you know and love (or hate).
Install the tool from NuGet or follow the Hello World Tutorial:
dotnet tool install --global TerminalGuiDesignerUpdate to the latest version using
dotnet tool update --global TerminalGuiDesignerThis project is in alpha. See the feature list for progress.
If you are targetting Terminal.Gui version 2 (currently pre-alpha) then you will want to install version 2 of the designer
dotnet tool install --global TerminalGuiDesigner --prereleaseEnsure that you match the Terminal.Gui library version you reference to the designer version.
Build using the dotnet 8.0 sdk
cd src
dotnet runInstall the dotnet sdk and create a new console application with references to Terminal.Gui. Install the TerminalGuiDesigner and create a new dialog:
dotnet new console -n hello
cd hello
dotnet add package Terminal.Gui
dotnet tool install --global TerminalGuiDesigner
TerminalGuiDesigner MyDialog.csEnter a namespace then add a Button to the view. Save with Ctrl+S. Exit the designer with Ctrl+Q.
Enter the following into Program.cs
using Terminal.Gui;
Application.Init();
Application.Run(new YourNamespace.MyDialog());
Application.Shutdown();Run your program with
dotnet run
You can add new code to MyDialog.cs but avoid making any changes to MyDialog.Designer.cs as this will be rewritten when saving.
For example in MyDialog.cs after InitializeComponent() add the following:
button1.Accepting += ()=>MessageBox.Query("Hello","Hello World","Ok");Now when run clicking the button will trigger a message box.
You can re-open the designer by running it from the command line with the file you want to edit/create.
TerminalGuiDesigner MyDialog.csYou can remove the tool using the following:
dotnet tool uninstall --global TerminalGuiDesignerIf when running the tool you have issues seeing the colors add the --usc flag:
TerminalGuiDesigner --uscThe designer is built to be robust and has top level catch blocks but if you are still able to crash it you may find your console blocking input. If this happens you should be able to fix your console by typing reset but also :heart: please report it :heart:
You can change keybindings by copying Keys.yaml into your current directory.
To edit MenuBar items use the following controls
| Key | Action |
|---|---|
| Shift Up/Down | Move selected menu item up/down |
| Shift Right | Move selected menu item to a submenu of the one above |
| Shift Left | Move selected sub menu item up a level |
| Del | Remove selected menu item |
| Enter | Add a new menu item |
| Typing | Edit the Title of the selected item |
| Ctrl + T | Set Shortcut |
| Ctrl + R | Set menu field name |
New root level menus can be added by right clicking the MenuBar and selecting 'Add Menu'.
You can create a menu separator by typing ---
The following feature list shows the current capabilities and the roadmap. Features in
italics are experimental and require passing the -e flag when starting application.
(Name)InitializeComponent before dependersA LeftOf B)View Types e.g. MyCustomViewabstract classesMyDialog)class MyDialog : MyOtherDialog暂无开放 Issues,或尚未同步最近议题。