Página 1 de 1

Best way to catch keystrokes?

Publicado: Lun Oct 08, 2007 11:09 am
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