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.

Best way to catch keystrokes?

Xailer professional forum in English
Mahanimann
Mensajes: 216
Registrado: Dom Sep 23, 2007 11:08 pm

Best way to catch keystrokes?

Mensaje por Mahanimann »

Hi,
Sorry for making this message so big, I still hope some of you gurus will
take some time to read it :-)
I started using Xailer last week (Clipper and some Xbase++ background) and
are about to make a new app based on a big DOS Clipper app (a complete
rewrite) and would very much have thoughts, pointers, ideas concerning this:
I will have 2 main type windows (in the end about 30-40 of them):
1) An edit window (with TDBMaskEdit, TDBComboBox, and also some with
TDBBrowse)
2) A browse window where it is allowed to edit some fields/columns.
They will both have a TDBNavigator (modified to suit the two main window
types needs) and a TStatusBar .
I have made a function (pd_OpenWindow()) which I was thinking could open all
the 1) and 2) windows. There I can among other things do f.ex:
* Attach the "keyhandler" for hotkeys preset in (the modified) TDBNavigator
* Attach a "keyhandler" for app global keystrokes (f.ex. F12=Calculator)
* Enable/disable/show/hide certain TDBNavigator buttons subsequent to window
type ( 1) or 2) )
* Watch if a window is allready open, if it is, give it focus instead of
open a new instance
* Attach code to change the background color on edit-controls to reflect if
that they are in EDIT- or VIEW-mode
* Create the standard TStatusBar
My goal is to make the use of the app as speedy as possible, among other
things make the need for a mouse as unnecessary as possible. I will have a
set of hotkeys which will do the same everywhere in the app:
F1 = Help F2=Enter EDIT-mode, F3=New, F4=Delete, ESC=Cancel edit-mode,
PGDN=Save-exit edit mode, F9=Call browse-window etc.
For that I need a generic way to trap keystrokes and send keys through at
least 3 "keyhandlers" (i.e. trap for hotkeys set in TDBNavigator, window
specific hotkeys and app-global hotkeys) . What is the best way to approach
this in a generic way? (I also need to know if a hotkey is used in EDIT- or
VIEW-mode)
Any feedback will be very, very much appreciated.
Paal
Responder