There’s any way to catch onkeypress in the whole page ?
Like: If I running this page www.brasiltrack.com/mobile , I want to know when the user hit any key on keyboard (like using bluethooth keyboard in this case).
There’s any way to catch onkeypress in the whole page ?
Like: If I running this page www.brasiltrack.com/mobile , I want to know when the user hit any key on keyboard (like using bluethooth keyboard in this case).
Currently, components has not default key handlers, but you can extend any element of ui on the fly , and add the such possibility
dhx.extend($$("some_element"), dhx.KeyEvents);
$$("myform").attachEvent("onKeyPress", function(code, ctrl, shift, ev){
do_something();
});
You can use above code against the top level layout, to catch events anywhere inside it.
Hi! I don’t understand.
I have the code below:
<script type="text/javascript">
var TNTForm, formData;
function doOnLoad() {
formData = [ {type: "input", name: "userName", label: "User name:"}];
TNTForm = new dhtmlXForm("TNTForm", formData);
dhx.extend($$("userName"), dhx.KeyEvents);
$$("TNTForm").attachEvent("onKeyPress", function(code, ctrl, shift, ev){
alert('You have pressed key!');
});
}
</script>
But, I can not capture the event.
Questions:
The above post is related to dhtmlx Touch lib, while you are using dhtmlxForm from desctop line of components those two are different libs and solution from one can’t be used with another.