Página 1 de 1

Tab order, and shortcut/hot keys

Publicado: Vie Abr 30, 2021 12:31 am
por DC
Hi,

Two questions and a subquestion

1) Other than Arrange Controls, is there a way to specify the tab order? Like this edit box is number 1, this button is 2nd, etc.?

2) How do we assign shortcut keys to Edit boxes and buttons?
2a) Is it possible to assign a single digit as a shortcut key, in order to make an Edit box active?
In other words, while the entire form is in focus, you type the number 1, and then the edit box becomes active and the shortcut keys become inactive. As soon as you exit the edit box and give the form focus, the shortcut keys become active again.
Is that possible?

Re: Tab order, and shortcut/hot keys

Publicado: Vie Abr 30, 2021 12:46 pm
por jfgimenez
Hi Dwayne,

1) No, sorry.

2) For buttons and other controls which have a "caption" or cText, use the & character just before the desired char. F.e. "Button &1".
For other controls like edits, you must set the shortcut to the previous control which cannot be focused (usually a TLabel).

2a) See the property lDirectShortCuts from TForm. It allows to use the shortcut without pressing the "alt" key. But, it catches also keystrokes sent to edit controls, so you have to avoid it. I've attached a working sample that override the form's WMChar() method.

Re: Tab order, and shortcut/hot keys

Publicado: Dom May 02, 2021 8:58 pm
por DC
Thanks, Jose.