mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Feature to display the sub-menus on a single frame instead multiple frames.
This commit is contained in:
@@ -119,10 +119,10 @@ static class Demo {
|
||||
int i = 0;
|
||||
string txt = "Hello world, how are you doing today?";
|
||||
container.Add (
|
||||
new Label ($"{i+1}-{txt}") { TextAlignment = TextAlignment.Left, Y = 3, Width = Dim.Fill () },
|
||||
new Label ($"{i+2}-{txt}") { TextAlignment = TextAlignment.Right, Y = 5, Width = Dim.Fill () },
|
||||
new Label ($"{i+3}-{txt}") { TextAlignment = TextAlignment.Centered, Y = 7, Width = Dim.Fill () },
|
||||
new Label ($"{i+4}-{txt}") { TextAlignment = TextAlignment.Justified, Y = 9, Width = Dim.Fill () }
|
||||
new Label ($"{i + 1}-{txt}") { TextAlignment = TextAlignment.Left, Y = 3, Width = Dim.Fill () },
|
||||
new Label ($"{i + 2}-{txt}") { TextAlignment = TextAlignment.Right, Y = 5, Width = Dim.Fill () },
|
||||
new Label ($"{i + 3}-{txt}") { TextAlignment = TextAlignment.Centered, Y = 7, Width = Dim.Fill () },
|
||||
new Label ($"{i + 4}-{txt}") { TextAlignment = TextAlignment.Justified, Y = 9, Width = Dim.Fill () }
|
||||
);
|
||||
|
||||
Application.Run (container);
|
||||
@@ -487,15 +487,15 @@ static class Demo {
|
||||
.OrderBy (x => x).Select (x => ustring.Make (x)).ToList ();
|
||||
}
|
||||
}
|
||||
var list = new ComboBox () { Width = Dim.Fill(), Height = Dim.Fill() };
|
||||
list.SetSource(items);
|
||||
var list = new ComboBox () { Width = Dim.Fill (), Height = Dim.Fill () };
|
||||
list.SetSource (items);
|
||||
list.OpenSelectedItem += (ListViewItemEventArgs text) => { Application.RequestStop (); };
|
||||
|
||||
var d = new Dialog () { Title = "Select source file", Width = Dim.Percent (50), Height = Dim.Percent (50) };
|
||||
d.Add (list);
|
||||
Application.Run (d);
|
||||
|
||||
MessageBox.Query (60, 10, "Selected file", list.Text.ToString() == "" ? "Nothing selected" : list.Text.ToString(), "Ok");
|
||||
MessageBox.Query (60, 10, "Selected file", list.Text.ToString () == "" ? "Nothing selected" : list.Text.ToString (), "Ok");
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -564,10 +564,9 @@ static class Demo {
|
||||
#endregion
|
||||
|
||||
public static Action running = MainApp;
|
||||
static void Main(string[] args)
|
||||
static void Main (string [] args)
|
||||
{
|
||||
if (args.Length > 0 && args.Contains("-usc"))
|
||||
{
|
||||
if (args.Length > 0 && args.Contains ("-usc")) {
|
||||
Application.UseSystemConsole = true;
|
||||
}
|
||||
|
||||
@@ -588,7 +587,7 @@ static class Demo {
|
||||
if (Debugger.IsAttached)
|
||||
CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.GetCultureInfo ("en-US");
|
||||
|
||||
Application.Init();
|
||||
Application.Init ();
|
||||
Application.HeightAsBuffer = true;
|
||||
//ConsoleDriver.Diagnostics = ConsoleDriver.DiagnosticFlags.FramePadding | ConsoleDriver.DiagnosticFlags.FrameRuler;
|
||||
|
||||
@@ -621,6 +620,9 @@ static class Demo {
|
||||
menuItems [2].Action = () => ShowMenuItem (menuItems [2]);
|
||||
menuItems [3].Action = () => ShowMenuItem (menuItems [3]);
|
||||
|
||||
MenuItem miUseSubMenusSingleFrame = null;
|
||||
var useSubMenusSingleFrame = false;
|
||||
|
||||
menu = new MenuBar (new MenuBarItem [] {
|
||||
new MenuBarItem ("_File", new MenuItem [] {
|
||||
new MenuItem ("Text _Editor Demo", "", () => { running = Editor; Application.RequestStop (); }, null, null, Key.AltMask | Key.CtrlMask | Key.D),
|
||||
@@ -638,7 +640,11 @@ static class Demo {
|
||||
new MenuItem ("_Paste", "", Paste, null, null, Key.AltMask | Key.CtrlMask| Key.V),
|
||||
new MenuBarItem ("_Find and Replace",
|
||||
new MenuItem [] { menuItems [0], menuItems [1] }),
|
||||
menuItems[3]
|
||||
menuItems[3],
|
||||
miUseSubMenusSingleFrame = new MenuItem ("Use_SubMenusSingleFrame", "",
|
||||
() => menu.UseSubMenusSingleFrame = miUseSubMenusSingleFrame.Checked = useSubMenusSingleFrame = !useSubMenusSingleFrame) {
|
||||
CheckType = MenuItemCheckStyle.Checked, Checked = useSubMenusSingleFrame
|
||||
}
|
||||
}),
|
||||
new MenuBarItem ("_List Demos", new MenuItem [] {
|
||||
new MenuItem ("Select _Multiple Items", "", () => ListSelectionDemo (true), null, null, Key.AltMask + 0.ToString () [0]),
|
||||
|
||||
Reference in New Issue
Block a user