Skip to content

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

Closed
@tznind

Description

@tznind

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    ✅ Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions