/Revisting the gui.cs framework – Miguel de Icaza

Revisting the gui.cs framework – Miguel de Icaza

12 years ago, I wrote a small UI Library to build console applications
in Unix using C#. I enjoyed writing a blog post that
hyped
this tiny
library as a platform for Rich Internet Applications (“RIA”). The
young among you might not know this, but back in 2010, “RIA” platforms
were all the rage, like Bitcoin was two years ago.

The blog post was written in a tongue-in-cheek style, but linked to
actual screenshots of this toy library, which revealed the joke:

First gui.cs application - a MonoTorrent client

This was the day that I realized that some folks did not read the
whole blog post, nor clicked on the screenshot links, as I received
three pieces of email about it.

The first was from an executive at Adobe asking why we were competing,
rather than partnering on this RIA framework. Back in 2010, Adobe was
famous for building the Flash and Flex platforms, two of the leading
RIA systems in the industry. The second was from a journalist trying
to find out more details about this new web framework, he was
interested in getting on the phone to discuss the details of the
announcement, and the third piece was from an industry analyst that
wanted to understand where what this announcement did for the
strategic placement of my employer in their five-dimensional industry
tracking mega-deltoid.

This tiny library was part of my curses
binding
for Mono in a time where
I dreamed of writing and bringing a complete terminal stack to .NET in
my copious spare time. Little did I know, that I was about to run out
of time, as in little less than a month, I would start
Moonlight
– the
open source clone of Microsoft Silverlight and that would consume my
time for a couple of years.

While Silverlight might have died, my desire to have a UI toolkit for
console applications with .NET did not. Some fourteen months ago, I
decided to work again on gui.cs, this is a screenshot of the result:

Sample app

In many ways the world had changed. You can now expect a fairly
modern version of curses to be available across all Unices and Unix
systems have proper terminfo databases installed.

Because I am a hopeless romantic, I called this new incarnation of the
UI toolkit, gui.cs. This time around, I have updated it to modern
.NET idioms, modern .NET build systems, and embraced the UIKit design
for some of the internals of the framework and Azure DevOps to run my
continuous builds and manage my releases to NuGet.

In addition, the toolkit is no longer tied to Unix, but contains
drivers for the Windows console, the .NET System.Console (a less
powerful version of the Windows console) and the ncurses library.

You can find the result in GitHub
https://github.com/migueldeicaza/gui.cs and you can install it on your
favorite operating system by installing the Terminal.Gui NuGet
package.

I have published both
conceptual
and API
documentation

for folks to get started with. Hopefully I will beat my previous
record of two users.

The original layout system for gui.cs was based on absolute
positioning – not bad for a quick hack. But this time around I wanted
something simpler to use. Sadly, UIKit is not a good source of
inspiration for simple to use layout systems, so I came up with a
novel system for widget
layout
,
one that I am quite fond of. This new system introduces two data
types Pos for specifying positions and Dim for specifying
dimensions.

As a developer, you assign Pos values to X, Y and Dim values
to Width and Height. The system comes with a range of ways of
specifying positions and dimensions, including referencing properties
from other views. So you can specify the layout in a way similar to
specifying formulas in a spreadsheet.

There is a one hour long presentation introducing various tools for
console programming with .NET. The section dealing just with gui.cs
starts at minute
29:28
, and you
can also get a copy of the slides.

https://youtu.be/Se1zNWJwDUE

Original Source