I create a simple-sample app with only one window. I put a KeyDown event on it. It works.
I place a WebViewer into this window. KeyDown does not fire. Even not a KeyDown in the Webviewer. Looks like the WebViewer grabs all keyboard events if it is in use?
Tried an input field, same result. Too simple to be worth a sample app. On the Mac it works. Did I miss anything? Any workarounds which work on Mac and Windows? I did not really want to use the Keyboard.Async stuff… Thank you all
OK, so far so good. I hate to ask “why-questions”, but here: Why is it possible to create a KeyDown event then? And by the way: Why couldn`t I grab the key anyhow? Even if it is given through to the HTMLViewer? I do not get it on the main window either … … even not in a textfield.
Try adding a new window, select all in the affected window, copy, and paste on the new window. Then remove the corrupted one, and rename the new one. Add the events you need to the new window.
Thanks for the tip, Michel. Did not work. Easy to reproduce. Even if the HTMLViewer is not active - the Keypress event is blocked always and completely.
Not a fix, but a couple of queries … AllowTabStop property… try setting that to false?
If you have added a KeyDown event, return false and try getting the keydown from the parent.
Let me understand. If you don’t add the DesktopHTMLViewer, the window keypress fires ?
Adding DesktopHTMLViewer to the window suppressed Keypress on the window itself ?
An HTLViewer is a separate execution context that handles which cn handle these events. I am fairly sure you don’t get MouseDown etc either. As has already been mentioned, you will probaby have to add some javascript to your Viewer to pass these events (assuming your Viewer doesm’t want them) over to the Xojo side and do whatever threr.
I had a similar problem with a PopMenue included in a Container. The behavior on Mac an Win seemed to be different. On Win the PopMenue seems to lose the Focus even if it is selected via mouse before.
I introduced therefore a Timer: #If TargetWindows Then
PopupMenu_1.SetFocus #Else
’ #EndIf
Then the KeyDown Event Handler in the container worked for me as expected for Win and Mac.
Maybe this can help you to ?!
Sorry, up to now not one of the more serious problems I reported was solved. Maximum frustration and desperation up to thoughts to change my development environment. I think they are not interested in problems caused by Windows OS.
YES!! That helps. I set the Setfocus on the Window with 50ms Timer - and it works. Nice idea, Thank you!