Fixed more menubar/statusbar

This commit is contained in:
Tig
2024-10-08 21:13:27 -04:00
parent 14e2391a10
commit 7630b35d86
7 changed files with 18 additions and 45 deletions

View File

@@ -224,7 +224,7 @@ public static partial class Application // Mouse handling
{
// The mouse was outside any View's Viewport.
Debug.Fail ("This should never happen. If it does please file an Issue!!");
// Debug.Fail ("This should never happen. If it does please file an Issue!!");
return;
}

View File

@@ -54,7 +54,7 @@ public class ASCIICustomButtonTest : Scenario
]
};
_scrollViewTestWindow = new ScrollViewTestWindow ();
_scrollViewTestWindow = new ScrollViewTestWindow { Y = Pos.Bottom (menu) };
top.Add (menu, _scrollViewTestWindow);
Application.Run (top);

View File

@@ -22,11 +22,6 @@ public class ClassExplorer : Scenario
Application.Init ();
var top = new Toplevel ();
var win = new Window
{
Title = GetName ()
};
var menu = new MenuBar
{
Menus =
@@ -61,6 +56,12 @@ public class ClassExplorer : Scenario
};
top.Add (menu);
var win = new Window
{
Title = GetName (),
Y = Pos.Bottom (menu)
};
_treeView = new TreeView<object> { X = 0, Y = 1, Width = Dim.Percent (50), Height = Dim.Fill () };
var lblSearch = new Label { Text = "Search" };

View File

@@ -25,7 +25,8 @@ public class ContextMenus : Scenario
// Setup - Create a top-level application window and configure it.
Window appWindow = new ()
{
Title = GetQuitKeyAndName ()
Title = GetQuitKeyAndName (),
Arrangement = ViewArrangement.Fixed
};
var text = "Context Menu";
@@ -93,18 +94,8 @@ public class ContextMenus : Scenario
Application.MouseEvent -= ApplicationMouseEvent;
};
var menu = new MenuBar
{
Menus =
[
new (
"_File",
new MenuItem [] { new ("_Quit", "", () => Application.RequestStop (), null, null, Application.QuitKey) })
]
};
var top = new Toplevel ();
top.Add (appWindow, menu);
top.Add (appWindow);
// Run - Start the application.
Application.Run (top);

View File

@@ -13,23 +13,12 @@ public class LineViewExample : Scenario
public override void Main ()
{
Application.Init ();
// Setup - Create a top-level application window and configure it.
Toplevel top = new ();
var menu = new MenuBar
var appWindow = new Window()
{
Menus =
[
new ("_File", new MenuItem [] { new ("_Quit", "", () => Quit ()) })
]
Title = GetQuitKeyAndName (),
};
top.Add (menu);
var appWindow = new Window ()
{
Y = 1,
Height = Dim.Fill (1) // BUGBUG: what if StatusBar is taller than 1?
};
appWindow.Add (new Label { Y = 1, Text = "Regular Line" });
// creates a horizontal line
@@ -78,22 +67,11 @@ public class LineViewExample : Scenario
appWindow.Add (verticalArrow);
var statusBar = new StatusBar (
new Shortcut []
{
new (Application.QuitKey, "Quit", Quit)
}
);
top.Add (appWindow);
top.Add (statusBar);
// Run - Start the application.
Application.Run (top);
top.Dispose ();
Application.Run (appWindow);
appWindow.Dispose ();
// Shutdown - Calling Application.Shutdown is required.
Application.Shutdown ();
}
private void Quit () { Application.RequestStop (); }
}

View File

@@ -177,6 +177,8 @@ public class Localization : Scenario
win.Add (wizardButton);
win.Unloaded += (sender, e) => Quit ();
win.Y = Pos.Bottom (menu);
top.Add (win);
Application.Run (top);

View File

@@ -147,6 +147,7 @@ public class WizardAsView : Scenario
lastStep.HelpText =
"The wizard is complete!\n\nPress the Finish button to continue.\n\nPressing Esc will cancel.";
wizard.Y = Pos.Bottom (menu);
topLevel.Add (wizard);
Application.Run (topLevel);
topLevel.Dispose ();