Fixes #3655 - Fixes rendering issue in Dialog/MessageBox (#3656)

* Fixed rendering issue

* Removed dead code

* Removed dead code
This commit is contained in:
Tig
2024-08-10 13:03:15 -06:00
committed by GitHub
parent 63e75b7413
commit 1f310fdb74
3 changed files with 17 additions and 17 deletions

View File

@@ -93,6 +93,22 @@ public class Dialog : Window
KeyBindings.Add (Key.Esc, Command.QuitToplevel);
}
// BUGBUG: We override GetNormal/FocusColor because "Dialog" ColorScheme is goofy.
// BUGBUG: By defn, a Dialog is Modal, and thus HasFocus is always true. OnDrawContent
// BUGBUG: Calls these methods.
// TODO: Fix this in https://github.com/gui-cs/Terminal.Gui/issues/2381
/// <inheritdoc />
public override Attribute GetNormalColor ()
{
return ColorScheme.Normal;
}
/// <inheritdoc />
public override Attribute GetFocusColor ()
{
return ColorScheme.Normal;
}
private bool _canceled;
/// <summary>Gets a value indicating whether the <see cref="Dialog"/> was canceled.</summary>
@@ -166,12 +182,5 @@ public class Dialog : Window
_buttons.Add (button);
Add (button);
SetNeedsDisplay ();
if (IsInitialized)
{
LayoutSubviews ();
}
}
}

View File

@@ -400,11 +400,6 @@ public static class MessageBox
d.TextFormatter.WordWrap = wrapMessage;
d.TextFormatter.MultiLine = !wrapMessage;
d.ColorScheme = new ColorScheme (d.ColorScheme)
{
Focus = d.ColorScheme.Normal
};
// Setup actions
Clicked = -1;
@@ -418,11 +413,6 @@ public static class MessageBox
Clicked = buttonId;
Application.RequestStop ();
};
if (b.IsDefault)
{
b.SetFocus ();
}
}
// Run the modal; do not shut down the mainloop driver when done

View File

@@ -263,6 +263,7 @@ public class Dialogs : Scenario
dialog = new ()
{
Title = titleEdit.Text,
Text = "Dialog Text",
ButtonAlignment = (Alignment)Enum.Parse (typeof (Alignment), alignmentRadioGroup.RadioLabels [alignmentRadioGroup.SelectedItem]),
Buttons = buttons.ToArray ()