Ask Reuben

Return v Enter

How can I use the “Enter” key in the numeric keypad to move between fields?

What is the difference between the two keys labelled “Enter”?

Where is the “Return” key?

Which is the “Return” key and which is the “Enter” key?

If you look at your typical PC keyboard, you may see that there are two keys with “Enter” written on them.   Both keys are typically bigger than your average key, each taking up two rows and/or two columns.   Typically one is positioned on the right hand side of the alpha-numeric part of the keyboard, and if there is a second “Enter” key it is positioned on the right hand side of the numeric keypad portion of the keyboard as pictured.

If you look in FGLDIR/lib/default.4ad, (the default action defaults file if none other is specified), the entry for the “accept” action you will see two accelerators, the acceleratorName attribute with a value of “Return”, and the acceleratorName2 attribute with a value of “Enter”.

<ActionDefault name="accept" text="OK" acceleratorName="Return" acceleratorName2="Enter" ...></ActionDefault>

This entry is mapping the two different “Enter” keys in the picture to trigger the “accept” action.

A common question is for the “Enter” key that is part of the numeric keyboard, to have that trigger the “nextfield” action instead of the “accept”action.  That is use it as an alternative to the “Tab” key.  This is quite common in high volume data entry scenarios where the users hand is positioned over the numeric keyboard as they enter a numeric code, quantity, or price etc.  It makes sense for them to press the “Enter” key here in the numeric keypad to move from one field to the next.

This raises a second question, which of the two keys labelled “Enter” is tied to the “Return” accelerator and which is tied to the “Enter” accelerator.  If you look closely at the keys, you will see that one has a symbol ↵ which is best described as an arrow pointing down and left.  This key is the “Return” key, and the symbolism dates back to the typewriter, the arrow pointing down and left symbolises the printer head moving down one line and back to the left hand side.  (As an aside this also relates to the CR/LF or ASCII(13), ASCII(10) characters used to represent an end of line in certain operating systems).  So a simple way to remember, is that the “Return” key has the symbol ↵ , whilst the “Enter” key does not.  If you are interested you can learn a little more about the Enter, Carriage Return, and Newline in their respective Wiki pages. 

Using this information, you can then in your Action Defaults (.4ad)  keep the “Return” key as the accelerator key name for the “accept” action, and use the “Enter” key in the numeric keypad as an alternative accelerator to the “nextfield” action to move from one field to the next. 

<ActionDefault name="accept" text="OK" acceleratorName="Return" ...></ActionDefault>
<ActionDefault name="nextfield" text="Next Field" acceleratorName="Tab" acceleratorName2="Enter" ...></ActionDefault>