KeyDown Event not firing on Form level

0
0

Hello,

I am encountering an issue with handling key values using the KeyDown event on a Window in my Wisej web application. Specifically, I am trying to capture key presses globally (at the form level), but the KeyDown event does not seem to catch or handle the key inputs as expected. No matter which control has focus, I want the event to fire. Is this intended?

I have provided simple code that tries to handle the KeyDown event on the form level and print the key value to the debug console. I have tested the exact same code in Windows Forms and it worked there just fine. The application has a few TextBox and ComboBox controls.

Attachment
  • You must to post comments
0
0

Hello Alaa,

Thank you for your previous response. I understand now that key events like KeyDown and KeyUp don’t propagate to the container by default.

Though I would still like to capture KeyDown events globally at the form level for a specific use case: I need to handle input from a barcode scanner. The scanner is configured to send a sequence of characters with a prefix and suffix that identify the input as coming from the scanner. I want to capture this entire sequence at the form level, regardless of which control has focus (e.g., TextBox, ComboBox, etc.). I could attach an event handler to a KeyDown event for every control, but this approach seems inefficient, since it would be difficult to maintain in an app with many controls.

How can I capture KeyDown events globally in Wisej.NET, so that I can detect and process the characters coming from the barcode scanner (including its configured prefix and suffix)?

Thank you.

Best regards,
Zan.

  • You must to post comments
0
0

Hi Zan,

The KeyUp and KeyDown events don’t propagate to the container, what you’re experiencing is the correct behavior in Wisej.NET!

Best Regards,

Alaa

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.