I have coded a Delphi FMX form for data entry on an Android app. This consists of several controls arranged vertically and aligned with horizontal centers. The controls are also all placed on a TVertScrollBox, so the controls can be scrolled into (and out of) view. There are a few TEdits, 2 TComboboxes, and 1 TComboEdit. I have also added the following code to my form
procedure TfrmMain.FormKeyDown(Sender: TObject; var Key: Word;
var KeyChar: Char; Shift: TShiftState);
begin
if Key = vkReturn then
begin
Key := vkTab;
KeyDown(Key, KeyChar, Shift);
end;
end;
Now this works fabulously for the TEdit controls in that the user can use the enter key (typically I set the TEdit.ReturnKeyType
property to Next) to navigate the list of controls, entering data for each one and hitting the enter key to move the focus to the next one.
There are 2 problems here.
As soon as the control is a TCombobox, the virtual keyboard disappears. In other words, there is no
.keyboardtype
or.ReturnKeyType
property on a TCombobox. So after selecting an entry for the combobox from the dropdown, they have to "reach in" and select the next control manually. Often they miss.The TEditCombo is a strange descendent indeed. It has a
.Keyboardtype
property, but it doesn't have a.ReturnKeyType
property. This has my users very confused because although they can type into this combobox, the return key doesn't say "Next" when this control has focus like it does on the TEdits.
How can I make all the controls on this form show the keyboard and have the "return key" move to the next control irrespective of the type of the current control or the next one?
Was I privileged to have programmed Windows apps using the VCL?