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

Resizing when a context menu is open causes the Enter event to get spammed #2095

Closed
tznind opened this issue Oct 18, 2022 · 2 comments · Fixed by #3193
Closed

Resizing when a context menu is open causes the Enter event to get spammed #2095

tznind opened this issue Oct 18, 2022 · 2 comments · Fixed by #3193
Labels

Comments

@tznind
Copy link
Collaborator

tznind commented Oct 18, 2022

Describe the bug
The Enter event seems to be incorrectly firing while context menus are open. Here is an app that demos the problem (see below). It is most apparent when resizing. Although I have also seen Enter events fired at other times when a context menu is opened (I first noticed it in TerminalGuiDesigner), in that case I think Enter was firing when the submenu popped.

Expected behavior
While a context menu is open no Enter events should be raised unless they are directly registered on the context menu itself.

using Terminal.Gui;

Application.Init();
Application.Top.ColorScheme = Colors.Base;

// for logging output
var events = new TextView { ReadOnly = true, X = 50, Y = 1, Width = Dim.Fill(), Height = Dim.Fill(), Text = "Events:"};

// a root view
var root = new View() { Width = Dim.Fill(), Height = Dim.Fill(), ColorScheme = Colors.Base };
root.Enter += (s) => { events.Text += $"\nEntered root";};
root.Add(events);

// with a label (that is focusable)
var lbl = new Label("Name:") { Y = 0, CanFocus = true };
lbl.Enter += (s) => events.Text += $"\nEntered Label";
root.Add(lbl);

// and a text field
var tf = new TextField() { X = Pos.Right(lbl) + 1, Width = 10 };
tf.Enter += (s)=> events.Text += $"\nEntered TextField";
root.Add(tf);

Application.Top.Add(root);
Application.Run();

wierdevents
Resizing when context menu is open causes misfiring Enter events

@tig tig added the bug label Oct 18, 2022
@tig
Copy link
Collaborator

tig commented Jan 19, 2024

Is this still repo?

@BDisp
Copy link
Collaborator

BDisp commented Jan 19, 2024

Is this still repo?

Yes it repro on the v1. Also see the gray background color before I click in the TextField. I think it's related with the #2571.

devenv_IUBJijiAYq.mp4

Not repro on v2.

devenv_Jev0yGL8O2.mp4

BDisp added a commit to BDisp/Terminal.Gui that referenced this issue Jan 19, 2024
@tig tig closed this as completed in #3193 Jan 20, 2024
tig pushed a commit that referenced this issue Jan 20, 2024
…ent to get spammed (#3193)

* Fixes #2095. Resizing when a context menu is open causes the Enter event to get spammed

* Update nuget packages.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants