Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Virtual keybord frustrations
Sun, Aug 9 2015 8:28 AMPermanent Link

Malcolm Taylor

I am looking for an elegant way to move to the next input field (TEdit)
when using a mobile device without a hardware keyboard.
This is specific to the TEdit control (single line) for now.

If the TEdit has its InputType property set to tiNumber, the VKbd
displays a '>' icon for the <enter> button.  This generates a tab and
does what is required - it exits the TEdit and moves to the next
control as expected.

But the other input types available cause the VKbd to display a
right-arrow icon for the <enter> button and generate a CR (#13) which
is then swallowed.

The two solutions I have at the moment are:

1.   Tap the device <Back> key/icon to close the VKbd (which does not
trigger an OnExit) then tap on the next control - which I think is
clumsy.

2.   Use the OnKeyDown to do the job as follows:

{code}
function TfrmMain.edtCityKeyDown(Sender: TObject; Key: Integer;
ShiftKey, CtrlKey, AltKey: Boolean): Boolean;
begin
 Result := True;
 if Key = VK_RETURN then
   // I originally tried Key := VK_TAB but, as Tim had stated, this
does not work
   // move to next item in tab-chain, but how do I know which that is?
   cbCountry.SetFocus;
 end;
end;
{code}   

The above code works, but it would be so much easier for me if the
behaviour of the tiNumber could be extended to the other InputTypes by
either allowing the developer to specify the ReturnKey result, or
simply assuming it should be a <tab> (for all single line controls).
Given that the VKbd icon already changes from a CR icon to a
right-arrow one, I wonder if it is a bug or a yet-to-be-implemented
feature?
Mon, Aug 10 2015 10:53 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Malcolm,

<< 2.   Use the OnKeyDown to do the job as follows: >>

That's your solution, but what you can use is this:

function TfrmMain.edtCityKeyDown(Sender: TObject; Key: Integer;
ShiftKey, CtrlKey, AltKey: Boolean): Boolean;
begin
 Result := True;
 if Key = VK_RETURN then
   begin
   TControl(Sender).Tab;
   Result:=False;  <<<<<<<  Important !!!!
   end;
end;

Reference:

http://stackoverflow.com/questions/23823308/how-to-get-next-button-on-android-softkeyboard-in-place-of-go-button-in-phonegap

I'll see about adding a "return as tab option" for controls, which will eliminate the need for such a key-down handler.

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Aug 10 2015 4:15 PMPermanent Link

Malcolm Taylor

Tim Young [Elevate Software] wrote:

> That's your solution, but what you can use is this:
>
> function TfrmMain.edtCityKeyDown(Sender: TObject; Key: Integer;
> ShiftKey, CtrlKey, AltKey: Boolean): Boolean;
> begin
>   Result := True;
>   if Key = VK_RETURN then
>     begin
>     TControl(Sender).Tab;
>     Result:=False;  <<<<<<<  Important !!!!
>     end;
> end;
>
> I'll see about adding a "return as tab option" for controls, which
> will eliminate the need for such a key-down handler.

Thanks for the code improvment tip, and I hope you do add that AsTab
option.  Surprised
Image