Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Hding virtual keyboard


This question is answered.


Permlink Replies: 4 - Last Post: Apr 20, 2018 3:32 PM Last Post By: Dave Nottage
Wayne Loeppky

Posts: 52
Registered: 7/4/02
Hding virtual keyboard  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 19, 2018 1:19 PM
Delphi 10.2, Firemonkey Android application. I have a TEdit which is used for scanning barcodes. The virtual keyboard pops up which covers a large portion of the screen where the results of the barcode scan show. I want to hide the virtual keyboard while the barcode scanning is being used since the keyboard is not required. I have read all the many suggestions on the web on how to hide the keyboard but none seem to work.

I am using a Samsung Galaxy S7 and Android 7.0 If I try to hide the virtual keyboard it disappears for a second or two and then reappears.

Is there any way to make the keyboard go away on a particular control?

Wayne
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Hding virtual keyboard  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 19, 2018 3:35 PM   in response to: Wayne Loeppky in response to: Wayne Loeppky
Wayne Loeppky wrote:

I have a TEdit which is used for scanning barcodes.

Why are you using a TEdit to receive scanned barcodes? You could use
something like zxing instead, which send your app an Intent with the
scanned barcode:

https://github.com/zxing/zxing/wiki/Scanning-Via-Intent

Or, have a look at Google's own Mobile Vision Barcode API:

https://developers.google.com/vision/android/barcodes-overview

https://developers.google.com/android/reference/com/google/android/gms/vision/barcode/Barcode

I have read all the many suggestions on the web on how to hide the
keyboard but none seem to work.

What EXACTLY have you tried, specifically?

--
Remy Lebeau (TeamB)
Wayne Loeppky

Posts: 52
Registered: 7/4/02
Re: Hding virtual keyboard  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 20, 2018 12:55 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Remy Lebeau (TeamB) wrote:
Wayne Loeppky wrote:

I have a TEdit which is used for scanning barcodes.

Why are you using a TEdit to receive scanned barcodes? You could use
something like zxing instead, which send your app an Intent with the
scanned barcode:

What EXACTLY have you tried, specifically?

-

I am using a TEdit to control the point where they can scan things and to provide an easy point to edit the barcode.

I have been working mainly with this type of code:

procedure TImagineMobileFormMain.EditTfrBarcodeEnter(Sender: TObject);
var
KeyboardService: IFMXVirtualKeyboardService;
begin
TPlatformServices.Current.SupportsPlatformService(IFMXVirtualKeyboardService, IInterface(KeyboardService));
if KeyboardService <> nil then
KeyboardService.HideVirtualKeyboard;
end;
Dave Nottage

Posts: 1,850
Registered: 1/7/00
Re: Hding virtual keyboard  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 20, 2018 3:32 PM   in response to: Wayne Loeppky in response to: Wayne Loeppky
Wayne Loeppky wrote:

I have been working mainly with this type of code:

procedure TImagineMobileFormMain.EditTfrBarcodeEnter(Sender: TObject);
var
KeyboardService: IFMXVirtualKeyboardService;
begin
TPlatformServices.Current.SupportsPlatformService(IFMXVirtualKeyboardService, IInterface(KeyboardService));
if KeyboardService <> nil then
KeyboardService.HideVirtualKeyboard;
end;

Attempting to hide the VK in OnEnter is problematic (as you've discovered). If the users are not normally allowed to
type anything into the edit, set ReadOnly to True, which prevents the VK from showing at all.

--
Dave Nottage [MVP, TeamB]
Find hints, tips and tricks at Delphi Worlds blog: http://www.delphiworlds.com
Dave Nottage

Posts: 1,850
Registered: 1/7/00
Re: Hding virtual keyboard
Correct
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 19, 2018 3:52 PM   in response to: Wayne Loeppky in response to: Wayne Loeppky
Wayne Loeppky wrote:

I have read all the many suggestions on the web on how to hide the keyboard but none seem to work.

I am using a Samsung Galaxy S7 and Android 7.0 If I try to hide the virtual keyboard it disappears for a second or
two and then reappears.

Please show your code. Simply setting ReadOnly to True should work; it does for me on my Nexus 5X using Android 8.1.

--
Dave Nottage [MVP, TeamB]
Find hints, tips and tricks at Delphi Worlds blog: http://www.delphiworlds.com
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02