web app keydown, gotfocus

First let me say that I am just starting to tinker with web apps and I’m some attempting basic things.

Is there problems with GotFocus or KeyDown in web app? Or am I missing something?

I have a rectangle on a webpage and nothing else, and neither of the following events do anything for me:

GotFocus:

Msgbox "Hey, I got focus!"

KeyDown:

Select Case details.KeyCode Case details.KeyArrowDown MsgBox("Right arrow") Case details.KeyArrowLeft MsgBox("Left arrow") Case details.KeyArrowRight MsgBox("Right arrow") Case details.KeyArrowUp MsgBox("Up arrow") End Select

Does anyone have any answer or idea on my question? :slight_smile:

A rectangle doesn’t support keystrokes nor gotfocus events.
Take instead a textarea and a button. Replace the msgbox with textarea1.text and set the text in that field.
If you then tab from the textarea to the button you will see the button getting focus but doesn’t act upon keystrokes. The textarea itself however will show both actions, gotfocus and keystrokes.

Replacing the textbox is needed because it steals the focus and then you are stuck in the msgbox.

hth,
Andre

Does the same apply to canvas ? Also, I don’t necessarily need msg box, I just put that in there as a test to see when it gets focus.

If a WebRectangle doesn’t support the GotFocus event, then the documentation shouldn’t have it listed as an event for that control.

That’s partly why I asked the original question. I want to know if I should be submitting a feedback report against Xojo or it’s documentation, or neither if I was doing something wrong.

GotFocus & KeyPressed also show up in the documentation for WebCanvas but is not available in the add event window.

Also, I should have typed KeyPressed in my original posting:

[quote=63527:@Joseph Morgan]ollowing events do anything for me:

GotFocus:[/quote]
If it does not work then why not send a feedback request? Thank you for starting this thread because I thought that I was writing my code wrong but what I did not realise it was the event that did not work.

[quote=63496:@Tom White]If a WebRectangle doesn’t support the GotFocus event, then the documentation shouldn’t have it listed as an event for that control.

[/quote]

I tried rectangle.setfocus. It does not generate an error but it does not trigger the gotfocus either. And there is no way to set the tabindex for rectangle either. Looks very much as there is no way. Gotfocus in a rectangle looks like a dead end.

As for Canvas, it simply does not have the gotfocus event.

[quote=63528:@Oliver Scott-Brown]If it does not work then why not send a feedback request? Thank you for starting this thread because I thought that I was writing my code wrong but what I did not realise it was the event that did not work.

[/quote]

Because, typically I like to check here first on the forum for some sort of soft verification before submitting to feedback. Many times, it’s not a “feedback-able” problem and I’m just missing something.

Joseph, i feel often the same. In this case the list of events to add and the functioning of the events isn’t consistent. As we don’t know what the intended behaviour is we can not say when a thing is malfunctioning especially when the docs aren’t consistent with the actual behaviour and/or the list of available events.
Just as Michel above has proven in his test the rectangle isn’t the only control where this problem is shown. I have the impression that since this new IDE this inconsistency in event-list/-behaviour and -docs has increased.