TerminalGuiDesigner 1.0.19

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global TerminalGuiDesigner --version 1.0.19                
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local TerminalGuiDesigner --version 1.0.19                
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=TerminalGuiDesigner&version=1.0.19                
nuke :add-package TerminalGuiDesigner --version 1.0.19                

Terminal Gui Designer

example workflow NuGet Badge Code Coverage

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 TerminalGuiDesigner

Update to the latest version using

dotnet tool update --global TerminalGuiDesigner

This project is in alpha. See the feature list for progress.

newdemo

Building


Build using the dotnet 6.0 sdk

cd src
dotnet run

Usage


Install 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.cs

Enter 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.Clicked += ()=>MessageBox.Query("Hello","Hello World","Ok");

Now when run clicking the button will trigger a message box.

msgbox

You can re-open the designer by running it from the command line with the file you want to edit/create.

TerminalGuiDesigner MyDialog.cs

You can remove the tool using the following:

dotnet tool uninstall --global TerminalGuiDesigner

Troubleshooting

If when running the tool you have issues seeing the colors add the --usc flag:

TerminalGuiDesigner --usc

The 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<enter> but also ❤️ please report it ❤️

Keybindings & Controls


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 ---

Features


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.

  • Design classes
    • Window
    • Dialog
    • View
    • Top level
  • Configure root properties (e.g. Window.Width, Title etc)
  • Configure subview properties
    • (Name)
    • X/Y
    • Width/Height
    • Text
    • Color Schemes
  • Edit multiple Views' property at once (e.g. select 3 views and set all Width to 10)
  • Mouse Input
    • Drag to move
    • Drag into/out of sub view
    • Drag to resize
  • Undo/Redo
  • Direct editing of Text just by typing
  • Easy Menu Bar Designing
    • Create new items
    • Move items
    • Move in/out of submenus
    • Add menu bar separators (Type '---')
    • Assign shortcuts
    • Set fieldnames (Name)
  • Easy Status Bar Designing
  • Create Events e.g. MyButton_OnClick
  • View Dependency Management
    • Prevent deleting views where other Views hold RelativeTo dependencies
    • Write out dependant views to InitializeComponent before dependers
    • Order Multi Delete operations to delete dependers before dependants
  • Mutli select
    • Multi delete
    • Multi keyboard move
    • Multi mouse drag move
    • Multi set Property
    • Multi Copy/Paste
  • Copy/Paste
    • Single simple views
    • Cut
    • Container views (e.g. TabView)
    • To OS clipboard (e.g. open one Designer.cs View and copy to another)
    • Retain PosRelative mappings in pasted views (e.g. A LeftOf B)
  • Move views to subviews
    • With mouse
    • With keyboard
  • Read and present xmldoc comments when editing properties
  • Dev Environment Integration
    • Visual Studio plugin (e.g. right click a .Designer.cs to open in TerminalGuiDesigner console)
    • Visual Studio Code plugin
  • Comprehensive Tests
  • CI
  • Ability to lock some of the views (prevent changes). This prevents accidentally dragging a given control
  • Support adding user defined View Types e.g. MyCustomView
  • Corner Cases
    • Allow designing abstract classes
    • Allow designing generic classes (e.g. MyDialog<T>)
    • Allow designing classes that inherit from another e.g. class MyDialog : MyOtherDialog
      • Inherited views should be locked to prevent editing
  • Create and edit views
    • Button
    • Checkbox
    • ComboBox
    • DateField
    • FrameView
    • GraphView
    • HexView
    • Label
    • LineView
    • ListView
    • MenuBar
      • Copy/Paste preserve menu entries
    • ProgressBar
    • RadioGroup
    • StatusBar
    • TableView
      • Add/Remove Columns
      • Copy/Paste preserve table schema
    • TabView
      • Add/Remove new Tabs
      • Reorder Tabs
      • Copy/Paste preserve tabs/content
    • TextField
    • TextValidateField
    • TextView
    • TimeField
    • TreeView
    • View

Class Diagram


Terminal.Gui Class Diagram

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last updated
2.0.0-alpha.2203 372 8/24/2024
2.0.0-alpha.2189 88 8/23/2024
1.1.0 3,241 12/2/2023
1.1.0-rc1 236 12/1/2023
1.0.25 850 9/8/2023
1.0.24 1,608 4/7/2023
1.0.23 3,272 2/6/2023
1.0.22 544 1/24/2023
1.0.21 435 1/24/2023
1.0.20 682 11/21/2022
1.0.19 470 11/13/2022
1.0.18 947 8/29/2022
1.0.17 1,048 8/3/2022
1.0.16 852 7/25/2022
1.0.15 948 7/2/2022
1.0.14 716 6/29/2022
1.0.13 743 6/22/2022
1.0.12 648 6/18/2022
1.0.11 727 6/18/2022
1.0.10 686 6/11/2022
1.0.9 769 5/25/2022
1.0.8 754 5/17/2022
1.0.7 690 5/8/2022
1.0.6 701 4/24/2022
1.0.5 722 4/21/2022
1.0.4 655 4/19/2022
1.0.3 652 4/12/2022
1.0.1 664 4/8/2022
1.0.0 766 4/5/2022

v1.0.19
* Added `-e` experimental mode flag that lets you create new TopLevel and View classes
* Added dotted border around Views that do not have any visible boundary (e.g. `View`, `TabView` with ShowBorder off)
* Visual improvements in dialog boxes
* Fixed several issues around dragging and dropping (especially into containers)
* Fixed issue with color scheme designer not showing color swatches
* Fixed issue with sub-containers inside TabView not recursively saving all contents
   v1.0.18
* Fixed Checkbox ticking/unticking itself when typing 'space' (e.g. editing its name)
* Fixed issues where pasted/new items sometimes did not receive focus
* Fixed select all not working
v1.0.17
* Added prompt if there are unsaved changes when closing  
* Fixed bug where code generated for PosRelative could not compile due to statement sequence order
* Updated to use Terminal.Gui 1.7.1 package
v1.0.16
* Support for designing ColorSchemes
* Ability to update the same field on multiple selected Views at once (e.g. set all width to 10)
* Selection color (defaults to green) is now applied to single selections (e.g. tab/mouse selection).  Previously this scheme was only used for multi selection
* Lower right status text now shows when there is an ongoing multi selection (e.g. 'Selected: 3 objects')
* Fixed new FrameView instances being created with Text instead of Title set
* Added DrawMarginFrame as a designable property on Window allowing for removing Border from root view if desired
* Multi Copy/paste now preserves/maps PosRelative (e.g. view1.X = Pos.Right(otherView)) when all referenced views are in the copy/paste collection
v1.0.15
* Fixed bug generating code for Pos/Dim values that had decimal places (e.g. Percent(60))
v1.0.14
    * Improved MenuBar undo and fixed stability issues
    * Deleting the last item on a MenuBar now removes the MenuBar too
    * Added multi copy/paste (drag selection box and copy/paste).  Still restricted to non container views (i.e. not TabView etc)
   v1.0.13
    * Changing LineView Orientation now properly flips rune and Width/Height
    * Fixed mouse drag moving and resizing container views (e.g. TabView)
    * Fixed bug where you were able to copy/paste the root view
   v1.0.12
    * Fixed bug multi selections including tab views
   v1.0.11
    * Multi select support for delete and keyboard move
    * Prevent Copy/Paste on root view
    * Prevent changing Height on Buttons
    * Added nuget icon
   v1.0.10
    * Support for setting shortcuts in menus (defaults to Ctrl+T)
    * Support for renaming menu items (defaults to Ctrl+R)
    * Delete added to view context menu
    * Blank values in Pos/Dim editor (e.g. Margin size) are now treated as 0
   v1.0.9
    * Support for adding menu separators by typing '---'
    * Prevent deleting when another view has a RelativeTo specified on it
    * Warn when overwritting a file when creating a new View
    * Replaced generic code comments in files generated to indicate the tool and version used
    * Added copy and paste of single views
    * Support for dragging a control into a seperate container (e.g. into a tab view)
    * Prevent illegal field `(Name)` values being entered
    * Fixed bad code being generated if multiple tables/tab views had columns/tabs with the same name
   v1.0.8
    * Fixed bug free typing new titles for checkboxes
    * Fixed bug free typing new titles dropping last character typed
    * Added keybinding (defaults to Enter) for opening context menu
    * Changed context menu title from 'Properties' to the fieldname of the control being edited
   v1.0.7
    * Support for editing MenuBars
   v1.0.6
    * Fixed bug adding Views to newly created TabViews
    * Fixed undo for operations performed via context menus
    * Added Try/Catch to context menu operations
    * Added support for TreeView
    * Changed TableView example data to be all nulls
v1.0.5
* Right click context menu support
* Increased mouse resizing click hit box
* Added progress indicator for creating new Views
* Fixed mouse dragging/resizing of views in subviews (e.g. TabViews)