Weird effect when using Listbox.DoubleClick

I have a moveable modal window (win2) that I instantiate and show(modal) as a reaction to different events in the main window:
PushbuttonAction, Listbox.Keydown and Listbox Doubleclick. It’s always the same code:

dim frm as new win2
msgbox "Done"

The modal window has KeyDown events for itself and its only control, a pushbutton.
Both will close the window if ESC is pressed.

The funny thing is: when Listbox.Doubleclick opens win2 then no keydown is recognized and therefore no action is taken. In the Debugger the KeyDown code is never executed.
If win2 is opened by a Pushbutton.Action or a Listbox.Keydown then everything works as expected.

This behavior is in Xojo R2019 R1.1 as well as in Xojo 2019 R2. Is this some known behavior or just a bug?

Thanks in advance

As a test, change that to standard window… even if you really need it to be that; test it, please.

Yes, you are right in that if win2 is a document window (and shown non-modal) then this effect will not happen, so it’s the listboxes Doubleclick plus ShowModal that’s responsible.

Forgot to mention: This is all on windows10.

This is not Listbox per se, but the use of the wrong window type, IMHO. That is why it works on a Standard window.

The link above explain (a bit) why; when using a Modal Window. Try the Human Interface Guidelines document for more explanation.

You’ll get an answer since you’ve reported that as <>

I think this might be related to: <>
Does the Workaround described there help for this situation, too?
→ Open the Modal Dialog/Window using Xojo.Core.Timer.CallLater

@Emile Schwarz
Thanks for your answer but the windows design guidelines did not really help me in this matter. I do need modal windows at some places and I do need a working keydown event on them.

@Jürg Otter
Thank’s Jürg, it actually seems to be related, at least the workaround works. I had been wondering about <> before opening <> but with the Keydown still working on some keys was unsure. I will note that in the feedback case.

And that is the problem I suspected: some windows are made for special stuff and some other allows other stuff.