Page 1 of 1

Se puede asignar una tecla a un boton? en aplicacion web

PostPosted: Sat Oct 01, 2016 8:27 am
by gusgusl
Necesito en una aplicación que corre en la web que contiene un botón que el usuario pueda hacer click en ese botón sin necesidad de hacerlo con el raton sino haciéndolo mediante el teclado asignándole una tecla, es posible?

Re: Se puede asignar una tecla a un boton? en aplicacion web

PostPosted: Sun Oct 02, 2016 2:59 pm
by Neosoft Support
To trap a key press you could try adding something like this to your app's Start Up action (Project > Events):

Code: Select all
BeginJS
window.addEventListener("keydown", function(e){
  if (e.key = 77) {
    alert( 'You pressed the letter m.' );
  }
});
EndJS


This code displays an alert box when the letter 'm' is pressed.

Re: Se puede asignar una tecla a un boton? en aplicacion web

PostPosted: Wed Oct 05, 2016 4:52 pm
by gusgusl
En la version final de "Neoapp" se podra hacer esto de manera mas facil desde el cuadro de propiedades?
como se hace en "Neobook"?

Mi pregunta se traslada a otros comandos que son muy faciles de usar en "Neobook" como lo es "MessageBox" que en "Neoapp" se torna complicado su manejo ya que se debe llamar a una subrutina para poder leer la opcion elegida por el usuario

In the final version of "Neoapp" you may do this more easily from the properties box?
as is done in "Neobook"?

My question is transferred to other commands that are very easy to use "Neobook" as is "MessageBox" in "Neoapp" becomes complicated handling as it should call a subroutine to read the option chosen by the user

Re: Se puede asignar una tecla a un boton? en aplicacion web

PostPosted: Sat Oct 08, 2016 6:38 pm
by Neosoft Support
In the final version of "Neoapp" you may do this more easily from the properties box?
as is done in "Neobook"?


Possibly. Unlike Windows apps there isn't a straightforward feature for assigning shortcut keys to buttons. HTML does have an accesskey attribute, but it's handled slightly differently by different browsers. It's also limited to specific key combinations. A description of accesskey below:

http://www.w3schools.com/tags/att_global_accesskey.asp

My question is transferred to other commands that are very easy to use "Neobook" as is "MessageBox" in "Neoapp" becomes complicated handling as it should call a subroutine to read the option chosen by the user


This is a limitation of JavaScript. See my answer here: http://www.neosoftware.com/community/viewtopic.php?f=38&t=21744