web keypressed doesn't work?

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.

Any ideas?

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.

in a webcontainer or weblistbox, just this: msgbox “hi”

it works on the webpage with a login webcontainer in it, but when I click on the login, keypressed no longer works anywhere.

suggestions? Do I need to do some kind of reset? webpage.setFocus doesn’t work.

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.

I also experienced similar behavior with chrome while testing.
However all was working fine with ff.
So try different browser.

NO. I can’t tell my clients what browser to use. What kind of programmer (although amateur) would I be if I told restricted clients?

My program is used by guys who are brilliant in some things, but some are lucky to find the ON button on their computer.


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.

makes sense?

tried that. got a verified (by Xojo) error in the weblistbox. Never saw anything beyond that from 'm.

this feedback item is ranked 86th: “Weblistbox Keypressed event does not fire”

Let’s move it up.

phillip … that makes perfect sense (I haven’t tested it but I’m assuming several KeyPressed don’t fire at the same time.)

but, I’m still not sure what you mean by several firing at the same time. Do I need to clear the keypressed somehow?

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 signed on to the FR.

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.

it appears I can’t get the container or the listbox to accept focus. I’ve got a msgbox in the gotFocus event and nothing happens.

could be it, eh?

Yes, No focus, no key event.


So any ideas on what could be preventing focus?

I do an embed and then container.setFocus command.

You can’t set focus on the container. It must be a control in the container.

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.