In all of our programs we design, we would like to embed certain keystrokes
that work for every single screen. For instance, we might want to make Ctl-P
always do a printscreen, and Ctl-V to pop up a standard version/help screen.
For maybe 60% of the other forms in our apps, we want to have certain other
keystrokes always do specific things, such as Ctrl-F to do a Find, Ctrl-A to
do an add.
Additionally, for all forms, we always want the option to add in extra
keystrokes that are specific to that form and that form only, such as Ctl-N
to maybe tab through tabpages, or some other highly specific task, related
only to that form.
So, it seems like we should make inherited forms. We have some set up, but
cannot seem to get all the keystroke handlers in all the right places. There
are a few different events that would seem to work, but we are not sure if
we are using them properly, or if putting them in one handler is better than
the other.
We have our uppermost parent base form, called frmBase1. In it we define the
"GLOBAL" keyhandlers Ctl-P and Ctl-V
Then we have our second form, called frmBase2. It inherits frmBase1. In it
we want to keep our global "GLOBAL" keyhandlers, as well as add in our
secondary keystroke handlers for about 60% of our forms.
Finally, we have our actual data form, that Inherits from frmBase2. In it we
want to have all Global, all secondary, and any custom key strokes specific
to that form.
Has anyone done this before? Any advice on which events to use? We tried
Keydown, OnKeydown, various overrides, as well as various overrides and made
sure to call Mybase.Keydown to cascade it upwards, but we just can't seem to
get it all working right.
Thanks!
|