Browse and Grid Key Trap
Previous topic  First topic  Next topic


When we want to implement a key catcher in a window that has a grid or a browser, there is a collision between two events, first EASYSKIP navigation (see more on this subject in EASYSKIP property in Browse or Grid control) and, the capture of the CREATE KEY (see more on the topic Key Controls section)
Cuando queremos implementar una captura de teclas en una ventana que tiene una Grid o un Browse, se produce una colisión entre dos eventos, por un lado la navegación por EASYSKIP (ver mas en sobre este tema en la propiedad EASYSKIP del control Browse o del control Grid) y por otro lado la captura del comando CREATE KEY (ver mas en el tópico Key de la sección Controls)

On the other hand, EASYSKIP behavior is enabled or suspended by:
Por su lado el comportamiento EASYSKIP se habilita o suspende mediante:

mg_Set( "myWin" , "myControl" , "EasySkip" , .T. | .F. )

On the side of the capture key of CREATE KEY command is possible, once evaluated the key, let it go to the Browse or Grid control.

Por el lado de la captura de teclas del comando CREATE KEY, es posible, una vez evaluada la tecla, dejarla pasar hacia el Browse o la Grid.

This is achieved through the return value of the function that is evaluated in the CREATE KEY ACTION property.
Esto se logra mediante el valor de Return de la funcion que se evalúa en la propiedad ACTION del CREATE KEY.

For example, suppose we have a trap of all the keys of the form or screen, and that in the event function is called myKeyEvaluate:
Por ejemplo, supongamos que tenemos un trap de todas las teclas del formulario o pantalla y que ante dicho evento se llama a la funcion myKeyEvaluate:

CREATE KEY ALL
   ACTION {|| myKeyEvaluate() }
END KEY


Within this function we can let go the key to the grid or the Browse (if any of these controls had focus when you press the key) or you couldnot propagate the key. As a last option would leave the default operation returning NIL
Dentro de dicha funcion podemos dejar pasar la tecla hacia la Grid o el Browse (en caso de que alguno de estos controles tuviera el foco al momento de presionar la tecla) o tambien podríamos no propagar la tecla. Como ultima opcion podriamos dejar el funcionamiento de default retornando NIL

Function myKeyEvaluate()
   if HB_isChar( mg_LastKey() )
      mg_Set( "d_window" , "myBrowseTextBoxSearch" , "value" , mg_LastKey() )
      Return __MG_KEY_PROPAGATE
   else
      if HB_IsNumeric( mg_LastKey() )
         Return __MG_KEY_NO_PROPAGATE
      endif
   endif
Return NIL


If we press the "A", Browse or Grid receive the Key and act with default behavior.
If you press the "3", Browse or Grid NOT receive the key.
If you press the "F5", Browse or Grid receive the Key and act with default behavior. (Return NIL).

Si presionamos la tecla "A", el Browse o la Grid recibirán la tecla y actuaran con su comportamiento preestablecido.
Si presionamos la tecla "3", el Browse o la Grid NO recibirán la tecla.
Si presionamos la tecla "F5", el Browse o la Grid recibirán la tecla y actuaran con su comportamiento preestablecido (Return NIL).


In the case of "A" and "F5", EASYSKIP property might act if that was enabled (by default is disabled)
En el caso de "A" y "F5" podria actuar la propiedad EASYSKIP en caso que estuviera habilitada (por default esta deshabilitada)



Marinas-GUI Version 03.06 and
Marinas-IDE Version 05.06 and
LEX Files Version 02.06


---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
last update: April 27
2017
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------




A Harbour/QT framework to make multiplatform programs

(©) Copyright 2009-2017 by Fernando Santolin (aka CarozoDeQuilmes)
CarozoDeQuilmes@gmail.com

2009-2017 Beta tester and full English translator: Bruno Luciani
Bruno.Luciani@gmail.com

2014-2015 Final English corrector: David Worboys
DavidWorboys@hotmail.com

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

www.marinas-gui.org


www.marinas-gui.org  

Previous topic  First topic  Next topic