diff --git a/Terminal.Gui/Views/TabView.cs b/Terminal.Gui/Views/TabView.cs
index 8d60a3b0d..394b2789d 100644
--- a/Terminal.Gui/Views/TabView.cs
+++ b/Terminal.Gui/Views/TabView.cs
@@ -22,11 +22,13 @@ namespace Terminal.Gui {
///
TabRowView tabsBar;
+ private class TabContentView : View { }
+
///
/// This sub view is the main client area of the current tab. It hosts the
/// of the tab, the
///
- View contentView;
+ TabContentView contentView;
private List tabs = new List ();
///
@@ -75,7 +77,13 @@ namespace Terminal.Gui {
if (selectedTab.View != null) {
// remove old content
- contentView.Remove (selectedTab.View);
+ if (selectedTab.View.Subviews.Count == 0) {
+ contentView.Remove (selectedTab.View);
+ } else {
+ foreach (var view in selectedTab.View.Subviews) {
+ contentView.Remove (view);
+ }
+ }
}
}
@@ -85,7 +93,13 @@ namespace Terminal.Gui {
// add new content
if (selectedTab.View != null) {
- contentView.Add (selectedTab.View);
+ if (selectedTab.View.Subviews.Count == 0) {
+ contentView.Add (selectedTab.View);
+ } else {
+ foreach (var view in selectedTab.View.Subviews) {
+ contentView.Add (view);
+ }
+ }
}
}
@@ -94,7 +108,6 @@ namespace Terminal.Gui {
if (old != value) {
OnSelectedTabChanged (old, value);
}
-
}
}
@@ -111,7 +124,7 @@ namespace Terminal.Gui {
public TabView () : base ()
{
CanFocus = true;
- contentView = new View ();
+ contentView = new TabContentView ();
tabsBar = new TabRowView (this);
ApplyStyleChanges ();
@@ -195,7 +208,7 @@ namespace Terminal.Gui {
int startAtY = Math.Max (0, GetTabHeight (true) - 1);
DrawFrame (new Rect (0, startAtY, bounds.Width,
- Math.Max (bounds.Height - spaceAtBottom - startAtY, 0)), 0, true);
+ Math.Max (bounds.Height - spaceAtBottom - startAtY, 0)), 0, true);
}
if (Tabs.Any ()) {
@@ -215,14 +228,9 @@ namespace Terminal.Gui {
{
base.Dispose (disposing);
- // The selected tab will automatically be disposed but
- // any tabs not visible will need to be manually disposed
-
+ // Manually dispose all tabs
foreach (var tab in Tabs) {
- if (!Equals (SelectedTab, tab)) {
- tab.View?.Dispose ();
- }
-
+ tab.View?.Dispose ();
}
}
diff --git a/Terminal.Gui/Windows/Dialog.cs b/Terminal.Gui/Windows/Dialog.cs
index e4b5f3361..b96bdf71c 100644
--- a/Terminal.Gui/Windows/Dialog.cs
+++ b/Terminal.Gui/Windows/Dialog.cs
@@ -187,7 +187,7 @@ namespace Terminal.Gui {
if (i == 0) {
// first (leftmost) button - always hard flush left
var left = Bounds.Width - ((Border.DrawMarginFrame ? 2 : 0) + Border.BorderThickness.Left + Border.BorderThickness.Right);
- button.X = Pos.AnchorEnd (left);
+ button.X = Pos.AnchorEnd (Math.Max (left, 0));
} else {
shiftLeft += button.Frame.Width + (spacing);
button.X = Pos.AnchorEnd (shiftLeft);
diff --git a/Terminal.Gui/Windows/Wizard.cs b/Terminal.Gui/Windows/Wizard.cs
index 0ffc3bd6e..f288b5f66 100644
--- a/Terminal.Gui/Windows/Wizard.cs
+++ b/Terminal.Gui/Windows/Wizard.cs
@@ -158,8 +158,14 @@ namespace Terminal.Gui {
///
public event Action TitleChanged;
- // The contentView works like the ContentView in FrameView.
- private View contentView = new View () { Data = "WizardContentView" };
+ ///
+ /// WizardContentView is an internal implementation detail of Window. It is used to host Views added with .
+ /// Its ONLY reason for being is to provide a simple way for Window to expose to those SubViews that the Window's Bounds
+ /// are actually deflated due to the border.
+ ///
+ class WizardContentView : View { }
+
+ private WizardContentView contentView = new WizardContentView ();
///
/// Sets or gets help text for the .If is empty
@@ -383,6 +389,7 @@ namespace Terminal.Gui {
AddKeyBinding (Key.Esc, Command.QuitToplevel);
}
+ Initialized += (s, e) => Wizard_Loaded ();
}
private void Wizard_Loaded ()