Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MenuBar leaves trails when mounted in a Window #2225

Closed
tznind opened this issue Nov 16, 2022 · 0 comments · Fixed by #2227
Closed

MenuBar leaves trails when mounted in a Window #2225

tznind opened this issue Nov 16, 2022 · 0 comments · Fixed by #2227
Labels

Comments

@tznind
Copy link
Collaborator

tznind commented Nov 16, 2022

Describe the bug
When mounting a MenuBar in a Window you get a trail left behind where underlying window does not update itself to clear the old menu.

This seems to be the behaviour in both 1.8.2 nuget package and on develop.

Resizing the window clears the old 'trailing' state:

menubar-trails

To Reproduce

Application.Init ();
MenuBar menubar;
MenuBarItem fileF9;
MenuItem runnewTask;
MenuItem exit;
MenuBarItem view;
MenuItem refreshNow;
MenuBarItem updateSpeed;
MenuItem high;
MenuItem normal;
MenuItem slow;
MenuItem paused;
var win = new Window ();
menubar = new Terminal.Gui.MenuBar ();
win.Width = Dim.Fill (0);
win.Height = Dim.Fill (0);
win.X = 0;
win.Y = 0;
win.Modal = false;
win.Text = "";
win.Border.BorderStyle = Terminal.Gui.BorderStyle.Single;
win.Border.BorderBrush = Terminal.Gui.Color.Blue;
win.Border.Effect3D = false;
win.Border.Effect3DBrush = null;
win.Border.DrawMarginFrame = true;
win.TextAlignment = Terminal.Gui.TextAlignment.Left;
win.Title = "Task Manager";
menubar.Width = Dim.Fill (0);
menubar.Height = 1;
menubar.X = 0;
menubar.Y = 0;
menubar.Data = "menubar";
menubar.Text = "";
menubar.TextAlignment = Terminal.Gui.TextAlignment.Left;
fileF9 = new Terminal.Gui.MenuBarItem ();
fileF9.Title = "_File (F9)";
runnewTask = new Terminal.Gui.MenuItem ();
runnewTask.Title = "Run new Task...";
runnewTask.Data = "RunnewTask";
runnewTask.Shortcut = ((Terminal.Gui.Key)(0u));
exit = new Terminal.Gui.MenuItem ();
exit.Title = "Exit";
exit.Data = "Exit";
exit.Shortcut = ((Terminal.Gui.Key)(0u));
fileF9.Children = new Terminal.Gui.MenuItem [] {
		runnewTask,
		exit};
view = new Terminal.Gui.MenuBarItem ();
view.Title = "View";
refreshNow = new Terminal.Gui.MenuItem ();
refreshNow.Title = "Refresh Now";
refreshNow.Data = "RefreshNow";
refreshNow.Shortcut = ((Terminal.Gui.Key)(0u));
updateSpeed = new Terminal.Gui.MenuBarItem ();
updateSpeed.Title = "Update Speed";
high = new Terminal.Gui.MenuItem ();
high.Title = "High";
high.Data = "High";
high.Shortcut = ((Terminal.Gui.Key)(0u));
normal = new Terminal.Gui.MenuItem ();
normal.Title = "Normal";
normal.Data = "Normal";
normal.Shortcut = ((Terminal.Gui.Key)(0u));
slow = new Terminal.Gui.MenuItem ();
slow.Title = "Slow";
slow.Data = "Slow";
slow.Shortcut = ((Terminal.Gui.Key)(0u));
paused = new Terminal.Gui.MenuItem ();
paused.Title = "Paused";
paused.Data = "Paused";
paused.Shortcut = ((Terminal.Gui.Key)(0u));
updateSpeed.Children = new Terminal.Gui.MenuItem [] {
		high,
		normal,
		slow,
		paused};
view.Children = new Terminal.Gui.MenuItem [] {
		refreshNow,
		updateSpeed};
menubar.Menus = new Terminal.Gui.MenuBarItem [] {
		fileF9,
		view};
win.Add (menubar);
Application.Run (win);
BDisp added a commit to BDisp/Terminal.Gui that referenced this issue Nov 16, 2022
@tig tig added the bug label Dec 4, 2022
@tig tig closed this as completed in #2227 Dec 4, 2022
tig added a commit that referenced this issue Dec 4, 2022
Fixes #2225. MenuBar leaves trails when mounted in a Window.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants