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
frm.ShowModal
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?
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.
I think this might be related to: <https://xojo.com/issue/54289>
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 <https://xojo.com/issue/54289> before opening <https://xojo.com/issue/58103> but with the Keydown still working on some keys was unsure. I will note that in the feedback case.