From my understanding you have a couple requirements:
- The form should redirect any input from the keyboard to a specific field, regardless of which field currently has focus.
- Presented information based on the input field in point #1 may or may not be available for a user to interact with (eg, copy the value of a field or add additional data to the information provided).
- This redirection should only occur on a definite number of forms, not on every form in the system.
Just a real quick note with point #3: It will be difficult to do what you are looking for without affecting every form in the system. Keyboard input would likely be managed at the FormRun level (the base class for all forms) or higher, so tapping into that in specific form instance would prove difficult and require considerable care that it doesn't impact every other form in the system. Because of this, you should focus on changing the specific form. Also, from my experience, several functions globally available on forms are not available for us to manage/override/edit (like certain steps in the Export to Excel function as an example), so it's unlikely you would be able to override keyboard interaction in any case.
The biggest problem stems from determining what input should be redirected and what input should not (eg Ctrl + C, Ctrl + X, etc). If requirement #2 does not need the ability for a user to do anything with the data except read it, then I would propose overriding the lostFocus
method of the input field with code that would automatically give focus back to the field. It would look something like this:
public void lostFocus()
{
super();
this.setFocus()
}
Again, the main problem with this being that the user will not be able to select anything else on the form. If the information is only to be read (like a summary screen, for example), this should not be an issue.
If the user does need to interact with the information presented (eg, to copy a description from a field), you could probably apply similar logic to those fields so that if any input would be entered, it would change focus to the input field. This could be triggered with the textChange
method, but you would likely miss some of the text during the transition:
public void textChange()
{
super();
//Note: the control fieldName will need to have AutoDeclaration set to Yes
fieldName.setFocus();
}
If this doesn't work properly, you may need to search for an ActiveX control, which should allow you to specify that all input goes to the input field, and update the content as needed. It would likely need to be all-encompassing (the control would contain controls for input and display), so it may not have the same look and feel as the rest of AX, but should be able to do what you need.