web keypressed seems to work on my initial webpage, but once I do anything, even closing a container, it no longer works in any control. I understand that Xojo doesn’t think this is important, but keyboard shortcuts are very important to me.
I am currently using it on a web app on several different places and it seems to be working fine. Care to give me a minimalistic example of what is not working? I might be able to contribute.
This is a shot in the dark but I’m curious what control currently has focus. I haven’t tested it but I’m assuming several KeyPressed don’t fire at the same time.
the webpage has focus with the login container sitting in it. Keypressed works. At the end of the login method and closing the login container is webpage.setFocus. Keypressed no longer works.
As far as I can tell, the keypress is not a universal message sent to the whole app every time the key is pressed. It is sent to the control that currently has a focus. Because of that, you might need to write a function to be called by each control on the keypress event.
For instance, on my login screen I have the keypress associated with the password button, so if you have the focus on anything other than that, it will not be fired.
Well technically only one control has focus at a time. So if you handle KeyPressed on your webpage but a random control has focus then it could not hit the code you want to hit. If you want it to work from anywhere in the app then I feel like you may need to handle the KeyPressed for every given object. Using AddHandler or subclasses you could capture KeyPressed for any control in focus and handle it appropriately.
I’ve got msgbox details.character in my listbox.keypressed event. I open a container and give the listbox focus, then click on the listbox and still get no response.
I’m from the DOS era, so oooyyy !!!
In my program, with keypressed working, I can enter a gymnastics routine in real time. Without, it takes ten times as long.
So, I created a rectangle called bob in my main window. I used bob.setFocus to give it focus and msgbox “Hi Bob” in the gotFocus event and msgbox details.character in the keypressed event.
… nothing.
Changing a label with details.character didn’t work either.
msgbox details.character works fine in the main window.
Tried other control too. nothing. Clicking on the control doesn’t even give it focus.