Canvas KeyDown

Hi everyone!

How are you guys today?

Is there a way to implement a keydown event on a webCanvas?

Alex

Does Keyboard — Xojo documentation

Work? I don’t do much Xojo web but docs don’t say it doesn’t work on web.

Hum,

I am not sure what @Paul_Birkholtz suggests would work for a Web app, since the Web app code runs on the server, not on the computer where the client works with the keyboard. Watching every key press would be time time consuming because it would increase communications between server and client.

My guess is that catching a key down event is for Desktop apps, I may be wrong though !

What would you like to by trapping a key down event ?

Keyboard Compatibility

Project Types Desktop
Operating Systems All

:slightly_smiling_face:

1 Like

I did preface my suggestion/guess with that I don’t do web apps much… And as others pictured it does work.

Thanks @brian_franco!

1 Like

It is not supported on Web. I have GraffitiEventManager and I think @Greg_O has a free offering.

2 Likes

You’re definitely the expert over me :rofl:

1 Like

Worth discussing why keyboard (and others) events are not supported out of the box on Web. Web is asynchronous, so it’s at the mercy of latency. On desktop, when a key is pressed, you get notified more or less immediately in a more-or-less synchronous framework. In Web, the event needs to be processed in the browser in an asynchronous framework then transmitted to the server, then processed in the server. There’s no guarantee of the order in which the events will be received or that it will happen quickly enough for your purposes given all the variables of latency including the possibility that users might spam your server with key events for kicks.

1 Like

@Alexandre_Cunha - assuming this is for the game you keep talking about, I think you (and your users) are going to be unsatisfied. In the real world, the latency will make it difficult for any time-sensitive actions.

1 Like

there is no keydown event on WebCanvas…

ok. not so complex to avoid my primary idea of using it. but ok. i’ll keep this on my mind.

yes and no… rsrsrs

it’s a place to create mazes online. nothing so complex.

I think Brian copied from the docs that say is available for all Desktop. As this is Web, is not available.

Agreed, I read the table wrong on first look. Saw project types and All and crossed the wires. I don’t do web projects really and I was just trying to help.

I’m not going to be trying to help anyone on web anymore. I’ll just keep in my corner, I promise.

all help is great. thank you anyway.

alex

I can tell it also applies to TextFields. In one of my web projects, a user can hardly type more than 2 characters at once without getting the order of characters messed up. More often than not, we can see characters being removed (like if using the backspace key) and further characters being added in the wrong place.

ok then.

no way to do this with xojo? only using JS?

If you want it to be reliable: correct.

1 Like