Recent

Author Topic: LAMW: Get rid of virtual keyboard when you hit 'Done'  (Read 2889 times)

c4p

  • Full Member
  • ***
  • Posts: 157
LAMW: Get rid of virtual keyboard when you hit 'Done'
« on: April 30, 2017, 12:00:23 pm »
First a big shout out to the dev(s) of LAMW and supporters of this forum....excellent work!
I have managed to create a near fully functional app on Android using Lazarus+LAMW, superb!   8-)

Maybe it's just me, but on my phone (Samsung J3 Android v5.1.1), when I enter text into an edit box and hit 'Done' or 'Next' on the virtual keyboard it pops up again thinking I want to paste something into the box.
Is there a close event to stop this? or a way to detect the done button had been hit and close the virtual keyboard? (I suspect the lack of an OnKeyPress event may be the issue) only way round it is to hit the phones back button, hardly ideal for a phone app and is the only pending issue on my app (apart from, no doubt, a load of bugs  :-\ )
It also does it on my Nexus 4 (also on android v5.1) but not on my Galaxy S4? (on android v6.0).... is this why? I don't think the keyboard type matters as the Nexus is using android (AOSP) and J3 using Samsung.
Searched but can't find anything relating to this, any help would be much appreciated.
« Last Edit: April 30, 2017, 10:05:07 pm by c4p »
Lazarus 2.0.12 r64642/FPC 3.2.0 LAMW v0.8.6.4 on Windows 10+Linux Mint 21.2, projects mainly built using AppCompat and Gradle v8.5

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: Get rid of virtual keyboard when you hit 'Done'
« Reply #1 on: April 30, 2017, 05:58:03 pm »
Hello c4p

Try handle AnddroidModule form "OnEnter" event with:

   methods from AnddroidModule form:

    procedure ToggleSoftInput();
    procedure HideSoftInput(); overload;
    procedure HideSoftInput(_view: jObject); overload;

    methods from jEditText:

    Procedure ImmShow;
    Procedure ImmHide;
    procedure SetImeOptions(_imeOption: TImeOptions);

PS.
Please, put "LAMW:" in your subject.
« Last Edit: April 30, 2017, 06:49:25 pm by jmpessoa »
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

c4p

  • Full Member
  • ***
  • Posts: 157
Re: LAMW: Get rid of virtual keyboard when you hit 'Done'
« Reply #2 on: April 30, 2017, 09:35:17 pm »
Hello c4p

1) Try handle AnddroidModule form "OnEnter" event with:

   methosd from AnddroidModule from:

    procedure ToggleSoftInput();
    procedure HideSoftInput(); overload;
    procedure HideSoftInput(_view: jObject); overload;

    methosd from From jEditText:

    Procedure ImmShow;
    Procedure ImmHide;
    procedure SetImeOptions(_imeOption: TImeOptions);

PS.
Please, put "LAMW:" in your subject.

Got it!
Added editbox.SetImeOptions(imeFlagNoFullScreen); to the Forms OnJNIPrompt event.
Many thanks for the info, this solved my issue.
Really appreciate your efforts with LAMW 8)
+1 
Lazarus 2.0.12 r64642/FPC 3.2.0 LAMW v0.8.6.4 on Windows 10+Linux Mint 21.2, projects mainly built using AppCompat and Gradle v8.5

 

TinyPortal © 2005-2018