Replies: 3 comments
-
There is Absolute positioning. The Dim/Fill is optional. You can also add stuff to Application.Init();
var scheme = new ColorScheme()
{
Normal = Application.Driver.MakeAttribute(Color.Green,Color.Black),
Focus = Application.Driver.MakeAttribute(Color.Green,Color.Black),
HotNormal = Application.Driver.MakeAttribute(Color.Green,Color.Black),
HotFocus = Application.Driver.MakeAttribute(Color.Green,Color.Black),
Disabled = Application.Driver.MakeAttribute(Color.Green,Color.Black),
};
Application.Top.ColorScheme = scheme;
var bar = new MenuBar(new []{
new MenuBarItem(
new []{
new MenuBarItem(){Title="_Open",Action=()=>{/*do something*/}},
new MenuBarItem(){Title="Close",Action=()=>{/*do something*/}},
new MenuBarItem(){Title="_HalfOpen",Action=()=>{/*do something*/}}
}){Title="File (F9)"}});
Application.Top.Add(bar);
var view = new View(){Y=1,Width=80,Height=23};
Application.Top.Add(view);
view.Add(new Label("User"){X=10,Y = 2});
view.Add(new Label("Pass"){X=10,Y = 3});
view.Add(new TextField("User"){X=18,Y = 2,Width=10});
view.Add(new TextField("Pass"){X=18,Y = 3,Width=10,Secret=true});
Application.Run(); Fullscreen will likely increase the console size but won't reposition the controls if they are positioned using absolute positioning. I suspect forcing the console itself to have a fixed size is hard and varies by OS / console implementation but you can just draw in a specific part of it (e.g. 80x23). |
Beta Was this translation helpful? Give feedback.
-
Yeah, as @tznind notes, Absolute positioning is your friend and will absolutely (pun intended) let you build a emulator like you want! |
Beta Was this translation helpful? Give feedback.
-
While the above approaches work, I think that terminal emulators will benefit from having their own View implementation and rendering on their own. I wrote a VT100 emulator (XtermSharp) and what happens is that the emulator is that it keeps track of the screen contents in its own internal representation. And then view needs just turn that internal representation into the contents that are displayed. I have not updated the XtermSharp "gui.cs" backend yet, but you can see how I implemented that one here: https://github.com/migueldeicaza/XtermSharp/tree/master/GuiCsHost In particular, look at the "TerminalView" type, and you will see that on the Redraw method, it copies the content from the underlying terminal engine into the display: https://github.com/migueldeicaza/XtermSharp/blob/master/GuiCsHost/TerminalView.cs |
Beta Was this translation helpful? Give feedback.
-
I'm implementing an IBM 3270 and 5250 terminal emulator, and I'm thinking of using Gui.cs for the terminal emulator, so I started to do some experiments and some things I couldn't solve ....
Anyway, my main doubt is, with Gui.cs, is it possible to implement something like this? :

Well, this emulator have a fixed number of rows and cols, and, I get sucked in this question when using GUI.cs, how I can set the console to have, for example, 80 cols and 23 rows ?
I make this question, because I saw the way the widgets are created on window, using that Dim.Fill() and so on...
Another question, there is a way to create a window, without that line border ?
how to deal when uses puts the console in full-screen, recalculate the position of every text on screen ?
Beta Was this translation helpful? Give feedback.
All reactions