You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Textbox KeyPressEventHandler e.Handled = true doesn't work #12
Keyboard events, like all events in Wisej, are routed to the server asynchronously. The Handled property is useful on the server side when managing the OnKeyDown/Up/Press events to signal that a child has handled the key. However, this has no effect on the client, unless you actually change the Text property to trigger a client update - I wouldn't recommend this approach unless really necessary.
If you want to handle keys as they are typed and be able to stop the browser from processing the key you have to do it on the client using the JavaScript provider. It's quite easy with Wisej. I have attached a sample project for you to use as a reference and a screen shot below of the script editor.
Drop the JavaScript component on the page or window. This will add the JavaScript and JavaScriptSource property to all controls.
You can either type the javascript code in JavaScript, or select a .js file in JavaScriptSource.
The javascript runs in the widget's context: this = widget, see code above. It runs only once when the page is loaded or reloaded.
Keeping the script above as a reference, we attach the "keypress" handler and handle the event. To stop it from both bubbling and "defaulting" use e.stop(). Otherwise you can use e.stopBubbling() and e.preventDefault().
I’d like to add that in Wisej there are other ways to invoke javascript from the server in addition to the JavaScript provider.
You can call Invoke() on any control and pass either a full script or a function name and arguments. See the overloads. The script always runs in the context of the control you invoked it on: “this” refers to the javascript widget. i.e. this.button1.Invoke(“hide”) will hide the client representation of the button.
Scripts are always run last in the request/response cycle.
There is also a web method callback system from JavaScript – call the server from the client marking an instance method [WebMethod] – and Wisej builds an entire object model on the client side under window.App. But this is a topic for the documentation and an example.
Hello Luca,
Thank you for your support. Can the Sample that you talked about up on this issue be available once again? I’ve tried to download it but it seems its not there! Can you provide it for us again?
Thank you
Adrian
Activity
itg-assistant commentedon Jun 12, 2026
Frank (ITG) answered 2016-05-01 19:06:18 UTC
Thanks Takashi,
we have logged this bug in our tracking system as WJ-7225.
We will post a new answer here when it is resolved.
itg-assistant commentedon Jun 12, 2026
Luca answered 2016-05-01 21:42:00 UTC
Hello Takashi,
Keyboard events, like all events in Wisej, are routed to the server asynchronously. The Handled property is useful on the server side when managing the OnKeyDown/Up/Press events to signal that a child has handled the key. However, this has no effect on the client, unless you actually change the Text property to trigger a client update - I wouldn't recommend this approach unless really necessary.
If you want to handle keys as they are typed and be able to stop the browser from processing the key you have to do it on the client using the JavaScript provider. It's quite easy with Wisej. I have attached a sample project for you to use as a reference and a screen shot below of the script editor.
Download the sample
Drop the JavaScript component on the page or window. This will add the JavaScript and JavaScriptSource property to all controls.
You can either type the javascript code in JavaScript, or select a .js file in JavaScriptSource.
The javascript runs in the widget's context: this = widget, see code above. It runs only once when the page is loaded or reloaded.
Keeping the script above as a reference, we attach the "keypress" handler and handle the event. To stop it from both bubbling and "defaulting" use e.stop(). Otherwise you can use e.stopBubbling() and e.preventDefault().
When you work directly in javascript we enter the qooxdoo realm. The full API is here: http://demo.qooxdoo.org/current/apiviewer/#qx
itg-assistant commentedon Jun 12, 2026
ITG Admin answered 2016-05-02 13:21:01 UTC
I’d like to add that in Wisej there are other ways to invoke javascript from the server in addition to the JavaScript provider.
You can call Invoke() on any control and pass either a full script or a function name and arguments. See the overloads. The script always runs in the context of the control you invoked it on: “this” refers to the javascript widget. i.e. this.button1.Invoke(“hide”) will hide the client representation of the button.
Scripts are always run last in the request/response cycle.
There is also a web method callback system from JavaScript – call the server from the client marking an instance method [WebMethod] – and Wisej builds an entire object model on the client side under window.App. But this is a topic for the documentation and an example.
itg-assistant commentedon Jun 12, 2026
Ngabo Adrian answered 2022-07-07 13:00:35 UTC
Hello Luca,
Thank you for your support. Can the Sample that you talked about up on this issue be available once again? I’ve tried to download it but it seems its not there! Can you provide it for us again?
Thank you
Adrian
itg-assistant commentedon Jun 12, 2026
Frank (ITG) answered 2022-07-07 13:21:26 UTC
Ngabo, please check out our sample here: https://github.com/iceteagroup/wisej-examples/tree/3.0/KeyboardHandling
Best regards, Frank
itg-assistant commentedon Jun 12, 2026
Ngabo Adrian answered 2022-07-07 15:06:22 UTC
Its alright, Thank you very much. I’ve seen it. Let me go through it.
Adrian