In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.

Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.

Databrowser keyboard handling

Xailer professional forum in English
Responder
Giuseppe Bogetti
Mensajes: 281
Registrado: Vie Ago 04, 2006 4:58 pm

Databrowser keyboard handling

Mensaje por Giuseppe Bogetti »

Hi,
I would like to modify the navigation behaviour of a TDbfDataBrowser to
allow CTRL-HOME to move to first column and CTRL-END to move to last
column.
This is the code I use and logging all calls to method I found that the
CTRL key is passed but not the HOME neither the END.
METHOD BrowseDataKeyDown( oSender, nKey, nFlags ) CLASS TxNovaTools
SWITCH nKey
CASE VK_HOME // Home
IF ( ( GetAsyncKeyState( VK_CONTROL ) & 1 ) == 1 )
:GoToLeftMost()
RETURN 0
ENDIF
CASE VK_END // End
IF ( ( GetAsyncKeyState( VK_CONTROL ) & 1 ) == 1 )
:GoToRighMost()
RETURN 0
ENDIF
CASE VK_CANCEL // DEL
............
............
END SWITCH
ENDIF
END WITH
RETURN Nil
How can I accomplish this ?
--
Best regards,
Giuseppe Bogetti
B.G. Soft
Cuneo - Italy
Avatar de Usuario
jfgimenez
Site Admin
Mensajes: 5718
Registrado: Lun Abr 06, 2015 8:48 pm
Contactar:

Databrowser keyboard handling

Mensaje por jfgimenez »

Guiseppe,
> Hi,
> I would like to modify the navigation behaviour of a TDbfDataBrowser to
> allow CTRL-HOME to move to first column and CTRL-END to move to last
> column.
>
> This is the code I use and logging all calls to method I found that the
> CTRL key is passed but not the HOME neither the END.
That's because VK_HOME and VK_END are processed directly by the control, and
the event OnKeyDown is not launched in that case. The only way to do what
you want is deriving the class:
CLASS TBrowse FROM XBrowse
METHOD WMKeyDown( nKey, nFlags )
ENDCLASS
METHOD WMKeyDown( nKey, nFlags ) CLASS TBrowse
IF lAnd( GetKeyState( VK_CONTROL ), 0x80 )
IF nKey == VK_HOME
:GoToLeftMost()
RETURN 0
ELSEIF nKey == VK_END
:GoToRighMost()
RETURN 0
ENDIF
ENDIF
RETURN Super:WMKeyDown( nKey, nFlags )
--
Regards,
Jose F. Gimenez
José F. Giménez
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
Avatar de Usuario
jfgimenez
Site Admin
Mensajes: 5718
Registrado: Lun Abr 06, 2015 8:48 pm
Contactar:

Databrowser keyboard handling

Mensaje por jfgimenez »

Guiseppe,
> Hi,
> I would like to modify the navigation behaviour of a TDbfDataBrowser to
> allow CTRL-HOME to move to first column and CTRL-END to move to last
> column.
>
> This is the code I use and logging all calls to method I found that the
> CTRL key is passed but not the HOME neither the END.
That's because VK_HOME and VK_END are processed directly by the control, and
the event OnKeyDown is not launched in that case. The only way to do what
you want is deriving the class:
CLASS TBrowse FROM XBrowse
METHOD WMKeyDown( nKey, nFlags )
ENDCLASS
METHOD WMKeyDown( nKey, nFlags ) CLASS TBrowse
IF lAnd( GetKeyState( VK_CONTROL ), 0x80 )
IF nKey == VK_HOME
:GoToLeftMost()
RETURN 0
ELSEIF nKey == VK_END
:GoToRighMost()
RETURN 0
ENDIF
ENDIF
RETURN Super:WMKeyDown( nKey, nFlags )
--
Regards,
Jose F. Gimenez
José F. Giménez
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
Giuseppe Bogetti
Mensajes: 281
Registrado: Vie Ago 04, 2006 4:58 pm

Databrowser keyboard handling

Mensaje por Giuseppe Bogetti »

Il Fri, 16 Dec 2005 20:48:43 +0100, Jose F. Gimenez ha scritto:
Jose,
Thanks
--
Best regards,
Giuseppe Bogetti
B.G. Soft
Cuneo - Italy
Giuseppe Bogetti
Mensajes: 281
Registrado: Vie Ago 04, 2006 4:58 pm

Databrowser keyboard handling

Mensaje por Giuseppe Bogetti »

Il Fri, 16 Dec 2005 20:48:43 +0100, Jose F. Gimenez ha scritto:
Jose,
Thanks
--
Best regards,
Giuseppe Bogetti
B.G. Soft
Cuneo - Italy
Responder