Scott Hanselman

It's 2020 and it is time for text mode with Gui.cs

September 02, 2020 Comment on this post [23] Posted in Open Source
Sponsored By

Nearly 16 years ago I complained that Windows is completely missing the TextMode boat. It's 2020 and it's TIME FOR TEXT MODE BABY.

I keep bumping into cool utilities made with Gui.cs. Miguel de Icaza made Midnight Commander (not Norton Commander, but evocative of it) and it's a joy.

Head out to an admin command prompt on your Windows 10 machine now and install it (assuming a recent Windows 10 build, you'll have winget):

winget install GNU.MidnightCommander

You run it with "mc" and even better if you've got Windows Terminal blinged out you'll be able bask in the ASCII COATED GLORY:

Midnight Commander is lovely

It works in WSL as well, since there's a Linux version with "apt install mc" so check that out, too!

Do YOU want to make apps like this? While Midnight Commander wasn't made with Gui.cs, it could have been. I spent YEARS making awesome text mode apps with TurboVision. Now we can make text mode apps with C#! There is even a complete Xterm/Vt100 emulator as well in the form of TerminalView.cs.

Is it hard? Nah! Go "dotnet new console" then "dotnet add package Terminal.Gui" and then copy these lines over the ones that are given you in Program.cs, then "dotnet run". Boom.

using Terminal.Gui;

class Demo {
static int Main ()
{
Application.Init ();

var n = MessageBox.Query (50, 7,
"Question", "Do you like console apps?", "Yes", "No");

return n;
}
}

There you go! You should go read about it now!

Do you like Console Apps?

If you want to see all the cool text controls you can use, check out the Terminal.Gui UI Catalog app and its source code.

Sure, it's not that new-fangled HTML, but let me tell you, you see these apps every day. The airport, the DMV, the mechanic, the doctor's office. Apps like these are FAST. It's useful to know that these kinds of apps exist...you'll never know when you might need to get back in to TEXT MODE!


Sponsor: Suffering from a lack of clarity around software bugs? Give your customers the experience they deserve and expect with error monitoring from Raygun.com. Installs in minutes, try it today!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
September 03, 2020 12:14
For Windows text mode lovers, there is Far Manager, yet another evolution of Norton Commander. Text GUI can be programmed using its API for plugins. It's rather tedious with native C++ API. Fortunately, there is FarNet, the plugin and framework for .NET modules. Plus, there are ready modules for PowerShell and F# scripting. https://github.com/nightroman/FarNet/wiki

I played with Gui.cs. It's really nice and powerful. I would definitely go for it if I was not already using Far Manager with FarNet. I'd like to share my way though, it has some advantages.
September 03, 2020 13:11
This world needs a Far Manager written in .net and running via SSH. Extending MC is a pain.

World needs something like:
dotnet tool install FarManager --global
September 03, 2020 20:06
Terminal.Gui is really interesting, I have also blogged about it a while ago
Developing Console-based UI in C#
September 03, 2020 21:55
Turbo Vision FTW!
Uwe
September 03, 2020 23:23
Any chance you can write a tutorial on how to utilize this library in Powershell? It would be very handy for quick sysadmin TUIs when you are sshed into a box.
September 04, 2020 7:28
Norton Commander - good times!
AV
September 04, 2020 8:14
Just use emacs Dired mode
September 04, 2020 10:39
Excelent. I am waiting for C# text GUI library for a long time. I will definetly explore it.
September 04, 2020 12:17
Personally I'm glad that text interfaces are gone. Probably because I'm quite young and don't have nostalgia around them.
September 04, 2020 12:19
Just curious: Why would someone do a TUI (text-based user interface) on a modern computer? Using C# implies that you're running on a device powerful enough for a traditional GUI.
September 04, 2020 15:51
@Pano Kontogiannis

Simple. Raw speed and productivity. Nothing beats Text-Mode when it comes to fast data input. With any modern computer, the bottleneck for data input is ALWAYS the user. Text-Mode and a trained user allow muscle-memory to be used, greatly optimizing the process.

No wonder check-in counters in airports use text-mode terminals. Hundreds of thousands of people use them every single day in a moderately sized airport, not to mention LAX, JFK, Schippol, Heathrow, ...
September 04, 2020 16:33
Hi There !
Thanks for your post .
September 04, 2020 16:34
Just use emacs Dired mode
September 04, 2020 17:55
Very nice.

Decades ago, when MFC was king, I had to write an app with a relatively sophisticated form (and some pop-ups) that had to run on Win16, Win32 and OS/2, and then back-ported to DOS (it was *that* long ago). I had completed the Win16 version with MSVC/MFC first, and coming up with the Win32 version wasn't too much effort, at least as far as the (MFC-based) UI was concerned. The OS/2 UI libraries were surprisingly (to me at the time) similar in design to raw Windows C, so I wrote a tiny MFC-like wrapper for OS/2 to build the UI so the top-most layer consisted of source files that were shared between all 3 projects.

Then came the need to support DOS...I spent quite a bit of time writing CButton, CListBox, CComboBox and similar classes, with support for tabbing, hotkeys, etc and even drop shadows when a window was made to pop up on top of another. Ultimately I managed to get it evolved enough that again, I could share the top-layer UI code. Being at my first dev job in my 20s, I was rather proud of myself as I thought it looked *really* good, and consistency was key for our customers. The one complaint I got was that I had not built in any support for the mouse...in text mode...

Unfortunately it wasn't without its own set of quirks, and I never fully managed to get away from a few platform-specific items that I had to fix with #ifdef conditionals. But it was fun to put together and learned a lot in the process.
September 04, 2020 19:10
I still have fond memories of Norton Commander back "in the day" when I started my career in IT. mc is the first thing I install to any Linux build I do so finding this is fantastic - thanks!

Oddly, on both machines I've installed it on (with winget) I have had to manually add the directory to the PATH env var.
September 04, 2020 19:53
doh... "admin command prompt." Oops.
September 04, 2020 21:55
@TheSwan

I created a little DSL for Powershell UIs: <a href=""https://github.com/code-numericoverflow/UIfied"" title=""UIfied"">UIfied</a>
It's multi-UI (Console, WPF, Web)
September 04, 2020 23:00
God lord. I, for one, am happy times have left text mode behind. And I am 49 years old, I spend my entire youth in text mode for crying out loud :)

I do not miss it ;)
September 05, 2020 9:03
Scott, I've been using Total Commander exclusively since 1999. I don't even know how to use Windows Explorer. It's the most awesome file manager ever, and a direct clone of Norton Commander which I loved.

Over the years I've tried to convince a number of people that they're totally missing the boat and should try Total Commander, but have not succeeded a single time. I've only met two other people in all that time that use it and they totally get it. Unbelievable...

Anyway, this is really cool. I'm all over it!
September 05, 2020 13:53
20 years back in college we friends developed such library in TC++ for our college projects.

Oh I still sometimes miss 0XB8000000. Not having internet had some advantage,it forced us to unknowingly reinvent the wheel by reading books / printed code listings in PC magazines!
September 09, 2020 0:43
I know this goes against the point of the UI and it would look clashy if included ... But I wish it had an image control. I have the perfect app for this framework but I need to have images which I have drawn an overlay on included.

Definitely looking at it for future projects though.
September 10, 2020 20:05
Feels like VB for DOS is making a comeback. I was one of the 112 people that actually bought a copy.
October 14, 2020 19:06
The Dwarf Fortress guys should adopt this, would greatly improve the UI, yet still keep it ASCII for the hard cores. Appease both camps.

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.