Watch, Follow, &
Connect with Us

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


Welcome, Guest
Guest Settings
Help

Thread: Bounds of FormVirtualKeyboardShown() is incorrect for Android applications



Permlink Replies: 5 - Last Post: Oct 11, 2017 8:59 AM Last Post By: Markus Humm Threads: [ Previous | Next ]
Fernando Maia

Posts: 2
Registered: 11/20/16
Bounds of FormVirtualKeyboardShown() is incorrect for Android applications
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 27, 2017 1:40 PM
Dears,

I have developed the "FormVirtualKeyboardShown" and "FormVirtualKeyboardHidden", that makes the VertScrollBox run up/down when the keyboard hides any screen field.

The problem is that the parameter "const Bounds : TRect" is incorrect (Bounds.Height) when running on Android´s APPs.

The same procedure run fines for iOS.

Does anyone was in problems with this procedures?

I am using Delphi Tokyo 10.2 with Firemonkey

Thanks!

Edited by: Fernando Maia on Sep 27, 2017 1:58 PM
Dave Nottage

Posts: 1,850
Registered: 1/7/00
Re: Bounds of FormVirtualKeyboardShown() is incorrect for Android applications [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 27, 2017 7:17 PM   in response to: Fernando Maia in response to: Fernando Maia
Fernando Maia wrote:

I have developed the "FormVirtualKeyboardShown" and "FormVirtualKeyboardHidden", that makes the VertScrollBox run
up/down when the keyboard hides any screen field.

The problem is that the parameter "const Bounds : TRect" is incorrect (Bounds.Height) when running on Android´s
APPs.

Known problem:

https://quality.embarcadero.com/browse/RSP-19023
https://quality.embarcadero.com/browse/RSP-19001
https://quality.embarcadero.com/browse/RSP-17917
https://quality.embarcadero.com/browse/RSP-17127

--
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: Bounds of FormVirtualKeyboardShown() is incorrect for Android applications [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 27, 2017 8:42 PM   in response to: Fernando Maia in response to: Fernando Maia
Fernando Maia wrote:

The problem is that the parameter "const Bounds : TRect" is incorrect (Bounds.Height) when running on Android´s APPs.

I've just published units in the Kastri Free project:

https://github.com/DelphiWorlds/KastriFree

Which works around this issue. In order to take advantage of it, you will need to subscribe to the
TVirtualKeyboardRectChange message defined in the DW.Messaging unit (which is in the Core folder), e.g:

// Include System.Messaging in the uses clause
 
type
  TForm1 = class(TForm)
  private
    procedure VirtualKeyboardRectChangeMessageHandler(const Sender: TObject; const M: TMessage);
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
  end;
 
...
 
uses
  DW.Messaging, DW.VirtualKeyboard.Helpers;
 
constructor TForm1.Create(AOwner: TComponent);
begin
  inherited;
  TMessageManager.DefaultManager.SubscribeToMessage(TVirtualKeyboardRectChangeMessage,
VirtualKeyboardRectChangeMessageHandler);
end;
 
destructor TForm1.Destroy;
begin
  TMessageManager.DefaultManager.Unsubscribe(TVirtualKeyboardRectChangeMessage,
VirtualKeyboardRectChangeMessageHandler);
  inherited;
end;
 
procedure TForm1.VirtualKeyboardRectChangeMessageHandler(const Sender: TObject; const M: TMessage);
var
  LRect: TRect;
begin
  LRect := TVirtualKeyboardRectChangeMessage(M).Value;
  // LRect now contains the actual rect of the VK
end;


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

Posts: 25
Registered: 11/26/06
Re: Bounds of FormVirtualKeyboardShown() is incorrect for Android applications [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 10, 2017 10:06 PM   in response to: Dave Nottage in response to: Dave Nottage
Thanks for sharing Dave. Your workaround is just what is needed to solve this critical issue. Our FirePower customers have complained about this issue with one of our components (TwwRecordView) and your insight has allowed us to workaround this issue and fix the Android virtual keyboard issue introduced by Tokyo for our components.

-Roy
Dave Nottage

Posts: 1,850
Registered: 1/7/00
Re: Bounds of FormVirtualKeyboardShown() is incorrect for Android applications [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 10, 2017 10:45 PM   in response to: Roy Woll in response to: Roy Woll
Roy Woll wrote:

Thanks for sharing Dave. Your workaround is just what is needed to solve this critical issue.

Awesome! Glad I could be of help, Roy.

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

Posts: 5,113
Registered: 11/9/03
Re: Bounds of FormVirtualKeyboardShown() is incorrect for Android applications [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 11, 2017 8:59 AM   in response to: Dave Nottage in response to: Dave Nottage
Am 11.10.2017 um 07:45 schrieb Dave Nottage (TeamB):
Roy Woll wrote:

Thanks for sharing Dave. Your workaround is just what is needed to solve this critical issue.

Awesome! Glad I could be of help, Roy.

Somebody also complained on the existing QP report about this.
I pointed him to this thread.

Greetings

Markus
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02