Hello,

I'd like to know whether there is a way to listen certain key pressings (key
a,>,1,...) on server side in wicket.

I've tried
.html:
<body wicket:id ="body"></body>
.java
body = new WebMarkupContainer("body");
body.add(new AjaxEventBehavior("onkeypress"){

               protected void onEvent(final AjaxRequestTarget target) {
                       LOG.debug("keypress");
               }
       });
Problem here is that event is generated only for "onclick" event, in case of
"onkeypress", nothing happens.
And even if I would be able to catch the "onkeypress" event, I'd still have
to figure out, which key was pressed.

And also I've tried wicket-contrib-input-events

add(new InputBehavior(new KeyType[] { KeyType.Left },
                EventType.click));

        add(new AjaxEventBehavior("onclick"){

            @Override
            protected void onEvent(AjaxRequestTarget target) {
                LOG.debug("Clicked left");

            }

        });


But problem there is that EventType.onkeypress is not supported.

Examples I made on main page, but eventually I would need to listen key
pressings on modalwindow's panel, which is placed on a page.

Thanks in advance,
Roland

Reply via email to