1749 Form design: Accelerator key feature
VERSIONS: Paradox 10 and later

SUBJECT: Accelerator key and focus on a button

BY: BERTIL ISBERG and ANDERS JONSSON
Date: 1 February 2004

If I have a label on a button and preceed one of the letters with &, that letter will be underscored and the button will automatically be assigned the accelerator key Alt+letter. This is a feature that has been missing in Paradox since version 1 for Windows.

But. If the button does NOT have tabstob on and you assign it an accelerator as described, the button will get focus when you use the accelerator key. This means that if you first press Alt+letter the code on button fires, if you after that hit Enter the code will fire again as the button has focus despite having tab stop off.


Accelerator key has to make the button the active object even though TabStop is off. Accelerator key will also execute the code. When button has focus, you can press it using the spacebar without changing the focus. Using Enter key, the code executes and focus moves to next object.

Note: You still can not Tab to the button as long as it has TabStop off.

To prevent Enter key from executing the code, add this to the button's action event.
if eventInfo.id()=FieldEnter then
    disableDefault
endif
disabledefault in keyPhysical() will block the button being pressed by Spacebar.

If you plan to use the accelerator keys, you should also accept that buttons should have TabStop checked. Otherwise, it's better to avoid the accelerator feature.

To index