Consultor Eletrônico



Kbase P138187: How to map a key to a Tab in an ABL Form in OpenEdge 10.2?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   12/4/2008
Status: Unverified

GOAL:

How to map a key to a Tab in an ABL Form?

GOAL:

How to map the Enter key to a Tab in an ABL Form?

FACT(s) (Environment):

OpenEdge Architect Category: Visual Designer
OpenEdge 10.2A
Windows

FIX:

In its simplest form, the following steps can be used to map a key (the Enter key in the example below) to a Tab in an ABL Form:

1) Set the KeyPreview property of the form to True (this means the form handles all key events from its contained controls).
2) Override the KeyPress (or KeyUp or KeyDown) event.
3) Check for the Enter key.
4) Call the form's ProcessTabKey method to perform the Tab.
5) e:Handled must be set to True to prevent the Enter key being processed.
METHOD OVERRIDE PROTECTED VOID OnKeyUp( INPUT e AS System.Windows.Forms.KeyEventArgs ):

SUPER:OnKeyUp(e).

IF Progress.Util.EnumHelper:AreEqual(e:KeyCode, System.Windows.Forms.Keys:Enter) THEN DO:
e:Handled = True.
ProcessTabKey(Progress.Util.EnumHelper:AreNotEqual(e:KeyCode, System.Windows.Forms.Keys:Shift)).
END.

END METHOD.

There are also some caveats with this approach, which are listed here: http://www.duncanmackenzie.net/blog/517/default.aspx.