diff --git a/Terminal.Gui/View/View.Hierarchy.cs b/Terminal.Gui/View/View.Hierarchy.cs
index b86b4bb6b..86d58131c 100644
--- a/Terminal.Gui/View/View.Hierarchy.cs
+++ b/Terminal.Gui/View/View.Hierarchy.cs
@@ -48,7 +48,7 @@ public partial class View // SuperView/SubView hierarchy management (SuperView,
_subviews = [];
}
- Debug.WriteLineIf (_subviews.Contains (view), $"BUGBUG: {view} has already been added to {this}.");
+ Debug.WriteLineIf (_subviews.Contains (view), $"WARNING: {view} has already been added to {this}.");
// TileView likes to add views that were previously added and have HasFocus = true. No bueno.
view.HasFocus = false;
diff --git a/Terminal.Gui/View/View.cs b/Terminal.Gui/View/View.cs
index fcf904c7c..f01c9c78d 100644
--- a/Terminal.Gui/View/View.cs
+++ b/Terminal.Gui/View/View.cs
@@ -392,12 +392,13 @@ public partial class View : Responder, ISupportInitializeNotification
/// Event fired when the value is being changed.
public event EventHandler? VisibleChanged;
+ // TODO: This API is a hack. We should make Visible propogate automatically, no? See https://github.com/gui-cs/Terminal.Gui/issues/3703
///
- /// INTERNAL method for determining if all the specified view and all views up the Superview hierarchy are visible.
+ /// INTERNAL Indicates whether all views up the Superview hierarchy are visible.
///
/// The view to test.
/// if `view.Visible` is or any Superview is not visible, otherwise.
- private static bool CanBeVisible (View view)
+ internal static bool CanBeVisible (View view)
{
if (!view.Visible)
{
diff --git a/Terminal.Gui/Views/ColorPicker.cs b/Terminal.Gui/Views/ColorPicker.cs
index 15f853ba8..9a5bde98d 100644
--- a/Terminal.Gui/Views/ColorPicker.cs
+++ b/Terminal.Gui/Views/ColorPicker.cs
@@ -89,7 +89,10 @@ public class ColorPicker : View
CreateTextField ();
SelectedColor = oldValue;
- LayoutSubviews ();
+ if (IsInitialized)
+ {
+ LayoutSubviews ();
+ }
}
///
diff --git a/Terminal.Gui/Views/Shortcut.cs b/Terminal.Gui/Views/Shortcut.cs
index 7ae3bf485..e7b9bc5db 100644
--- a/Terminal.Gui/Views/Shortcut.cs
+++ b/Terminal.Gui/Views/Shortcut.cs
@@ -742,6 +742,10 @@ public class Shortcut : View, IOrientation, IDesignable
break;
case KeyBindingScope.HotKey:
+ //if (!CanBeVisible(this))
+ //{
+ // return true;
+ //}
cancel = base.OnAccept () == true;
if (CanFocus)
diff --git a/UICatalog/Scenarios/Adornments.cs b/UICatalog/Scenarios/Adornments.cs
index 42bd156f0..26d78a05a 100644
--- a/UICatalog/Scenarios/Adornments.cs
+++ b/UICatalog/Scenarios/Adornments.cs
@@ -4,7 +4,7 @@ namespace UICatalog.Scenarios;
[ScenarioMetadata ("Adornments Demo", "Demonstrates Margin, Border, and Padding on Views.")]
[ScenarioCategory ("Layout")]
-[ScenarioCategory ("Borders")]
+[ScenarioCategory ("Adornments")]
public class Adornments : Scenario
{
public override void Main ()
diff --git a/UICatalog/Scenarios/AllViewsTester.cs b/UICatalog/Scenarios/AllViewsTester.cs
index 7b2480060..b744aae2f 100644
--- a/UICatalog/Scenarios/AllViewsTester.cs
+++ b/UICatalog/Scenarios/AllViewsTester.cs
@@ -11,7 +11,8 @@ namespace UICatalog.Scenarios;
[ScenarioMetadata ("All Views Tester", "Provides a test UI for all classes derived from View.")]
[ScenarioCategory ("Layout")]
[ScenarioCategory ("Tests")]
-[ScenarioCategory ("Top Level Windows")]
+[ScenarioCategory ("Controls")]
+[ScenarioCategory ("Adornments")]
public class AllViewsTester : Scenario
{
private readonly List _dimNames = new () { "Auto", "Percent", "Fill", "Absolute" };
diff --git a/UICatalog/Scenarios/BackgroundWorkerCollection.cs b/UICatalog/Scenarios/BackgroundWorkerCollection.cs
index 23ce04aea..3522f059e 100644
--- a/UICatalog/Scenarios/BackgroundWorkerCollection.cs
+++ b/UICatalog/Scenarios/BackgroundWorkerCollection.cs
@@ -10,7 +10,8 @@ namespace UICatalog.Scenarios;
[ScenarioMetadata ("BackgroundWorker Collection", "A persisting multi Toplevel BackgroundWorker threading")]
[ScenarioCategory ("Threading")]
-[ScenarioCategory ("Top Level Windows")]
+[ScenarioCategory ("Overlapped")]
+[ScenarioCategory ("Runnable")]
[ScenarioCategory ("Dialogs")]
[ScenarioCategory ("Controls")]
public class BackgroundWorkerCollection : Scenario
diff --git a/UICatalog/Scenarios/ChineseUI.cs b/UICatalog/Scenarios/ChineseUI.cs
index 059b6143c..e94a98d09 100644
--- a/UICatalog/Scenarios/ChineseUI.cs
+++ b/UICatalog/Scenarios/ChineseUI.cs
@@ -3,7 +3,7 @@
namespace UICatalog.Scenarios;
[ScenarioMetadata ("ChineseUI", "Chinese UI")]
-[ScenarioCategory ("Unicode")]
+[ScenarioCategory ("Text and Formatting")]
public class ChineseUI : Scenario
{
public override void Main ()
diff --git a/UICatalog/Scenarios/CsvEditor.cs b/UICatalog/Scenarios/CsvEditor.cs
index eda859932..29b655c38 100644
--- a/UICatalog/Scenarios/CsvEditor.cs
+++ b/UICatalog/Scenarios/CsvEditor.cs
@@ -16,7 +16,7 @@ namespace UICatalog.Scenarios;
[ScenarioCategory ("Dialogs")]
[ScenarioCategory ("Text and Formatting")]
[ScenarioCategory ("Dialogs")]
-[ScenarioCategory ("Top Level Windows")]
+[ScenarioCategory ("Overlapped")]
[ScenarioCategory ("Files and IO")]
public class CsvEditor : Scenario
{
diff --git a/UICatalog/Scenarios/DynamicMenuBar.cs b/UICatalog/Scenarios/DynamicMenuBar.cs
index a65536cb1..ad00a9a69 100644
--- a/UICatalog/Scenarios/DynamicMenuBar.cs
+++ b/UICatalog/Scenarios/DynamicMenuBar.cs
@@ -9,7 +9,7 @@ using Terminal.Gui;
namespace UICatalog.Scenarios;
[ScenarioMetadata ("Dynamic MenuBar", "Demonstrates how to change a MenuBar dynamically.")]
-[ScenarioCategory ("Top Level Windows")]
+[ScenarioCategory ("Overlapped")]
[ScenarioCategory ("Menus")]
public class DynamicMenuBar : Scenario
{
diff --git a/UICatalog/Scenarios/DynamicStatusBar.cs b/UICatalog/Scenarios/DynamicStatusBar.cs
index 6ef18b55c..f9205257f 100644
--- a/UICatalog/Scenarios/DynamicStatusBar.cs
+++ b/UICatalog/Scenarios/DynamicStatusBar.cs
@@ -10,7 +10,7 @@ using Terminal.Gui;
namespace UICatalog.Scenarios;
[ScenarioMetadata ("Dynamic StatusBar", "Demonstrates how to add and remove a StatusBar and change items dynamically.")]
-[ScenarioCategory ("Top Level Windows")]
+[ScenarioCategory ("Overlapped")]
public class DynamicStatusBar : Scenario
{
public override void Main ()
diff --git a/UICatalog/Scenarios/Editor.cs b/UICatalog/Scenarios/Editor.cs
index abf285985..65d250670 100644
--- a/UICatalog/Scenarios/Editor.cs
+++ b/UICatalog/Scenarios/Editor.cs
@@ -16,7 +16,7 @@ namespace UICatalog.Scenarios;
[ScenarioCategory ("Controls")]
[ScenarioCategory ("Dialogs")]
[ScenarioCategory ("Text and Formatting")]
-[ScenarioCategory ("Top Level Windows")]
+[ScenarioCategory ("Overlapped")]
[ScenarioCategory ("Files and IO")]
[ScenarioCategory ("TextView")]
[ScenarioCategory ("Menus")]
diff --git a/UICatalog/Scenarios/HexEditor.cs b/UICatalog/Scenarios/HexEditor.cs
index b941378c6..08029a0e7 100644
--- a/UICatalog/Scenarios/HexEditor.cs
+++ b/UICatalog/Scenarios/HexEditor.cs
@@ -8,7 +8,7 @@ namespace UICatalog.Scenarios;
[ScenarioCategory ("Controls")]
[ScenarioCategory ("Dialogs")]
[ScenarioCategory ("Text and Formatting")]
-[ScenarioCategory ("Top Level Windows")]
+[ScenarioCategory ("Overlapped")]
[ScenarioCategory ("Files and IO")]
public class HexEditor : Scenario
{
diff --git a/UICatalog/Scenarios/LineCanvasExperiment.cs b/UICatalog/Scenarios/LineCanvasExperiment.cs
index 88ec3b63c..e38175296 100644
--- a/UICatalog/Scenarios/LineCanvasExperiment.cs
+++ b/UICatalog/Scenarios/LineCanvasExperiment.cs
@@ -4,7 +4,7 @@ namespace UICatalog.Scenarios;
[ScenarioMetadata ("LineCanvas Experiments", "Experiments with LineCanvas")]
[ScenarioCategory ("Drawing")]
-[ScenarioCategory ("Borders")]
+[ScenarioCategory ("Adornments")]
[ScenarioCategory ("Proof of Concept")]
public class LineCanvasExperiment : Scenario
{
diff --git a/UICatalog/Scenarios/LineViewExample.cs b/UICatalog/Scenarios/LineViewExample.cs
index 7e6b18d53..9efeb30c9 100644
--- a/UICatalog/Scenarios/LineViewExample.cs
+++ b/UICatalog/Scenarios/LineViewExample.cs
@@ -6,7 +6,7 @@ namespace UICatalog.Scenarios;
[ScenarioMetadata ("Line View", "Demonstrates drawing lines using the LineView control.")]
[ScenarioCategory ("Controls")]
[ScenarioCategory ("LineView")]
-[ScenarioCategory ("Borders")]
+[ScenarioCategory ("Adornments")]
public class LineViewExample : Scenario
{
public override void Main ()
diff --git a/UICatalog/Scenarios/ListColumns.cs b/UICatalog/Scenarios/ListColumns.cs
index 8b02e5141..dc0433060 100644
--- a/UICatalog/Scenarios/ListColumns.cs
+++ b/UICatalog/Scenarios/ListColumns.cs
@@ -11,7 +11,7 @@ namespace UICatalog.Scenarios;
[ScenarioCategory ("Controls")]
[ScenarioCategory ("Dialogs")]
[ScenarioCategory ("Text and Formatting")]
-[ScenarioCategory ("Top Level Windows")]
+[ScenarioCategory ("Overlapped")]
[ScenarioCategory ("Scrolling")]
public class ListColumns : Scenario
{
diff --git a/UICatalog/Scenarios/Navigation.cs b/UICatalog/Scenarios/Navigation.cs
index fcfd2f04b..4b0b33ec0 100644
--- a/UICatalog/Scenarios/Navigation.cs
+++ b/UICatalog/Scenarios/Navigation.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Timers;
+using System.Timers;
using Terminal.Gui;
namespace UICatalog.Scenarios;
@@ -7,6 +6,7 @@ namespace UICatalog.Scenarios;
[ScenarioMetadata ("Navigation", "Navigation Tester")]
[ScenarioCategory ("Mouse and Keyboard")]
[ScenarioCategory ("Layout")]
+[ScenarioCategory ("Overlapped")]
public class Navigation : Scenario
{
private int _hotkeyCount;
@@ -75,35 +75,68 @@ public class Navigation : Scenario
Timer timer = new (10)
{
- AutoReset = true,
+ AutoReset = true
};
+
timer.Elapsed += (o, args) =>
{
-
if (progressBar.Fraction == 1.0)
{
progressBar.Fraction = 0;
}
+
progressBar.Fraction += 0.01f;
Application.Wakeup ();
progressBar.SetNeedsDisplay ();
-
};
timer.Start ();
- View overlappedView2 = CreateOverlappedView (3, Pos.Right (overlappedView1) + 2, Pos.Top (overlappedView1) + 1);
+ View overlappedView2 = CreateOverlappedView (3, 8, 10);
- var overlappedInOverlapped1 = CreateOverlappedView (4, 1, 4);
+ View overlappedInOverlapped1 = CreateOverlappedView (4, 1, 4);
overlappedView2.Add (overlappedInOverlapped1);
- var overlappedInOverlapped2 = CreateOverlappedView (5, 10, 7);
+ View overlappedInOverlapped2 = CreateOverlappedView (5, 10, 7);
overlappedView2.Add (overlappedInOverlapped2);
+ StatusBar statusBar = new ()
+ {
+
+ };
+
+ statusBar.Add (
+ new Shortcut ()
+ {
+ Title = "Close",
+ Text = "Hotkey",
+ Key = Key.F4,
+ Action = () =>
+ {
+ overlappedView2.Visible = false;
+ overlappedView2.Enabled = overlappedView2.Visible;
+ }
+ });
+ statusBar.Add (
+ new Shortcut ()
+ {
+ Title = "Close",
+ Text = "App",
+ KeyBindingScope = KeyBindingScope.Application,
+ Key = Key.F4.WithCtrl,
+ Action = () =>
+ {
+ overlappedView2.Visible = !overlappedView2.Visible;
+ overlappedView2.Enabled = overlappedView2.Visible;
+
+ }
+ });
+ overlappedView2.Add (statusBar);
+
ColorPicker colorPicker = new ()
{
- Y = Pos.AnchorEnd (),
+ Y = 12,
Width = Dim.Fill (),
Id = "colorPicker",
Style = new ()
@@ -117,6 +150,7 @@ public class Navigation : Scenario
colorPicker.SelectedColor = testFrame.ColorScheme.Normal.Background;
colorPicker.ColorChanged += ColorPicker_ColorChanged;
overlappedView2.Add (colorPicker);
+ overlappedView2.Width = 50;
testFrame.Add (overlappedView1);
testFrame.Add (overlappedView2);
@@ -151,13 +185,13 @@ public class Navigation : Scenario
Application.Shutdown ();
return;
+
void ColorPicker_ColorChanged (object sender, ColorEventArgs e)
{
testFrame.ColorScheme = testFrame.ColorScheme with { Normal = new (testFrame.ColorScheme.Normal.Foreground, e.CurrentValue) };
}
}
-
private View CreateOverlappedView (int id, Pos x, Pos y)
{
var overlapped = new View
diff --git a/UICatalog/Scenarios/RunTExample.cs b/UICatalog/Scenarios/RunTExample.cs
index 4dcb69030..b949718be 100644
--- a/UICatalog/Scenarios/RunTExample.cs
+++ b/UICatalog/Scenarios/RunTExample.cs
@@ -3,7 +3,8 @@
namespace UICatalog.Scenarios;
[ScenarioMetadata ("Run Example", "Illustrates using Application.Run to run a custom class")]
-[ScenarioCategory ("Top Level Windows")]
+[ScenarioCategory ("Runnable")]
+[ScenarioCategory ("Overlapped")]
public class RunTExample : Scenario
{
public override void Main ()
diff --git a/UICatalog/Scenarios/SingleBackgroundWorker.cs b/UICatalog/Scenarios/SingleBackgroundWorker.cs
index 3e990779f..51ee6881e 100644
--- a/UICatalog/Scenarios/SingleBackgroundWorker.cs
+++ b/UICatalog/Scenarios/SingleBackgroundWorker.cs
@@ -9,7 +9,8 @@ namespace UICatalog.Scenarios;
[ScenarioMetadata ("Single BackgroundWorker", "A single BackgroundWorker threading opening another Toplevel")]
[ScenarioCategory ("Threading")]
-[ScenarioCategory ("Top Level Windows")]
+[ScenarioCategory ("Overlapped")]
+[ScenarioCategory ("Runnable")]
public class SingleBackgroundWorker : Scenario
{
public override void Main ()
diff --git a/UICatalog/Scenarios/TableEditor.cs b/UICatalog/Scenarios/TableEditor.cs
index 542537ef6..f7f3d5f17 100644
--- a/UICatalog/Scenarios/TableEditor.cs
+++ b/UICatalog/Scenarios/TableEditor.cs
@@ -14,7 +14,7 @@ namespace UICatalog.Scenarios;
[ScenarioCategory ("Controls")]
[ScenarioCategory ("Dialogs")]
[ScenarioCategory ("Text and Formatting")]
-[ScenarioCategory ("Top Level Windows")]
+[ScenarioCategory ("Overlapped")]
public class TableEditor : Scenario
{
private readonly HashSet _checkedFileSystemInfos = new ();
diff --git a/UICatalog/Scenarios/ViewExperiments.cs b/UICatalog/Scenarios/ViewExperiments.cs
index 00870d0dc..c9db4478d 100644
--- a/UICatalog/Scenarios/ViewExperiments.cs
+++ b/UICatalog/Scenarios/ViewExperiments.cs
@@ -5,7 +5,7 @@ namespace UICatalog.Scenarios;
[ScenarioMetadata ("View Experiments", "v2 View Experiments")]
[ScenarioCategory ("Controls")]
-[ScenarioCategory ("Borders")]
+[ScenarioCategory ("Adornments")]
[ScenarioCategory ("Layout")]
[ScenarioCategory ("Proof of Concept")]
public class ViewExperiments : Scenario
diff --git a/UICatalog/Scenarios/Wizards.cs b/UICatalog/Scenarios/Wizards.cs
index dbd210cc2..c909ccd40 100644
--- a/UICatalog/Scenarios/Wizards.cs
+++ b/UICatalog/Scenarios/Wizards.cs
@@ -5,8 +5,10 @@ namespace UICatalog.Scenarios;
[ScenarioMetadata ("Wizards", "Demonstrates the Wizard class")]
[ScenarioCategory ("Dialogs")]
-[ScenarioCategory ("Top Level Windows")]
+[ScenarioCategory ("Overlapped")]
[ScenarioCategory ("Wizards")]
+[ScenarioCategory ("Runnable")]
+
public class Wizards : Scenario
{
public override void Main ()
diff --git a/UICatalog/UICatalog.cs b/UICatalog/UICatalog.cs
index 8d4693c0c..a6f90edfe 100644
--- a/UICatalog/UICatalog.cs
+++ b/UICatalog/UICatalog.cs
@@ -644,13 +644,6 @@ public class UICatalogApp
Add (CategoryList);
Add (ScenarioList);
- Add (MenuBar!);
-
- if (StatusBar is { })
- {
- Add (StatusBar);
- }
-
Loaded += LoadedHandler;
Unloaded += UnloadedHandler;