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

Revisit v2 Cancelable Event Pattern - was KeyDown and MouseEvent no longer fires for Listbox #3950

Open
tznind opened this issue Mar 2, 2025 · 2 comments · May be fixed by #3955
Open

Revisit v2 Cancelable Event Pattern - was KeyDown and MouseEvent no longer fires for Listbox #3950

tznind opened this issue Mar 2, 2025 · 2 comments · May be fixed by #3955
Labels
bug v2 For discussions, issues, etc... relavant for v2

Comments

@tznind
Copy link
Collaborator

tznind commented Mar 2, 2025

Describe the bug

Works for arrow keys but not letters

Issue is probably that keybindings, mousebindings and collection navigator consume the events before the users event.

I think that when the user has an explicit event tied to these then they should get priority.

Application.Init();

var w = new Window()
{
    Title = "Showcase"
};

var lv = new ListView()
{
    Width = Dim.Fill(),
    Height = Dim.Fill(),
};
w.Add(lv);
lv.SetSource(new ObservableCollection<string>(["cat","fish"]));

lv.MouseEvent += (_, e) =>
{
    if (e.IsSingleClicked)
    {
        // Also never happens
        MessageBox.Query("hey", "ok", "ok");
    }
};

lv.KeyDown += (_, e) =>
{
    MessageBox.Query("hey","ok","ok");
};

Application.Run(w);
Application.Shutdown();

To Reproduce
Steps to reproduce the behavior:

  1. Click into list
  2. press any letter key

Expected behavior
enter callback

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Set Project & Milestone
If you have access, please don't forget to set the right Project and Milestone.

@tznind tznind added bug v2 For discussions, issues, etc... relavant for v2 labels Mar 2, 2025
@tznind tznind changed the title KeyDown no longer fires for Listbox KeyDown and MouseEvent no longer fires for Listbox Mar 2, 2025
@BDisp
Copy link
Collaborator

BDisp commented Mar 2, 2025

Do you mean the user can by pass or change the ListView navigation behavior if he want?

@tznind
Copy link
Collaborator Author

tznind commented Mar 2, 2025

Yes, l think event should always have first priority since user can put anything in there.

BDisp added a commit to BDisp/Terminal.Gui that referenced this issue Mar 3, 2025
@tig tig changed the title KeyDown and MouseEvent no longer fires for Listbox Revisit v2 Cancelable Event Pattern - was KeyDown and MouseEvent no longer fires for Listbox Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug v2 For discussions, issues, etc... relavant for v2
Projects
None yet
2 participants