Watch, Follow, &
Connect with Us

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


Welcome, Guest
Guest Settings
Help

Thread: Understanding VirtualKeyboardDemo



Permlink Replies: 13 - Last Post: Jun 1, 2017 3:40 AM Last Post By: pepito62490 pep...
Markus Humm

Posts: 5,113
Registered: 11/9/03
Understanding VirtualKeyboardDemo
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 10, 2015 2:42 PM
Hello,

I'm using Delphi 10 Seattle and I try to implement the technique used in
the VirtualKeyboardDemo app to slide the contents of my Android app if
the keyboard overlaps with some edits.

For one of my screens it works, for another one it only works if the
user has had at least one interaction with the preceeding screen,
otherwise it crashes the app completely with some logmessages pointing
to the GL graphics used by FMX or so.

But my main issue is the quite dynamic screen where it simply doesn't
work and seems to be called 2 times, which I cannot prevent no matter
how many boolean flags I implement and I don't understand why this
happens at all.

So can somebody please explain the CalcBounds Event Code and the
KBBounds code which is supposed to enlarge the TVerticalScrollbox and
move it's viewport around.

I just don't seem to be fit enough to understand all the details and how
and why they do what they do. I tried to read the help topics, but the
global picture still escapes me.

Greetings

Markus
Malcolm Taylor

Posts: 148
Registered: 7/16/01
Re: Understanding VirtualKeyboardDemo
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 16, 2015 1:41 AM   in response to: Markus Humm in response to: Markus Humm
Hi Marcus

I also has problems using the code in that demo for Android.

You mentioned the case where it only works after a previous
interaction. I also saw that when the first TEdit accessed would have
been covered, but I noticed that if I closed the vkbd then tried again
it did work. So I figured there was some initialisation or procedural
problem. I failed to track it down so I took the easy route and called
UpdateKBBounds before the user could attempt the first edit which
seemed to work for me.

But the killer for me was that the code does not handle the case where
a TEdit is initially positioned below the bottom of the screen. Yes,
you can scroll the TEdit up into view then tap on it .. but the vkbd
then pops up and covers the TEdit or even scrolls it back down to its
original location. OK, the user can then scroll the TEdit back into
view - but that's a bad user experience.

So I have abandoned that code and I also found a similar problem (for
TEdits below bottom of screen) when I tried the TControlMover code I
think I mentioned to you earlier(?).

The good news for me is that the vkbdhelper.pas unit mentioned in the
following link has solved my issues:
http://www.fmxexpress.com/keep-controls-visible-when-virtual-keyboard-opens-in-delphi-xe8-firemonkey-on-android/

You might want to have a look at it. Google Translate works well
enough for the comments in the unit.
But I did find that it does not work out-of-the-box inside a
TScaledLayout .. it seems to need an update to take scaling into
account.

Malcolm
Markus Humm

Posts: 5,113
Registered: 11/9/03
Re: Understanding VirtualKeyboardDemo
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 16, 2015 12:15 PM   in response to: Malcolm Taylor in response to: Malcolm Taylor
Am 16.11.2015 um 10:41 schrieb Malcolm Taylor:
Hi Marcus

I also has problems using the code in that demo for Android.

You mentioned the case where it only works after a previous
interaction. I also saw that when the first TEdit accessed would have
been covered, but I noticed that if I closed the vkbd then tried again
it did work. So I figured there was some initialisation or procedural
problem. I failed to track it down so I took the easy route and called
UpdateKBBounds before the user could attempt the first edit which
seemed to work for me.

But the killer for me was that the code does not handle the case where
a TEdit is initially positioned below the bottom of the screen. Yes,
you can scroll the TEdit up into view then tap on it .. but the vkbd
then pops up and covers the TEdit or even scrolls it back down to its
original location. OK, the user can then scroll the TEdit back into
view - but that's a bad user experience.

So I have abandoned that code and I also found a similar problem (for
TEdits below bottom of screen) when I tried the TControlMover code I
think I mentioned to you earlier(?).

The good news for me is that the vkbdhelper.pas unit mentioned in the
following link has solved my issues:
http://www.fmxexpress.com/keep-controls-visible-when-virtual-keyboard-opens-in-delphi-xe8-firemonkey-on-android/

You might want to have a look at it. Google Translate works well
enough for the comments in the unit.
But I did find that it does not work out-of-the-box inside a
TScaledLayout .. it seems to need an update to take scaling into
account.

Malcolm

Hello,

thanks for this valuable answer!
I'll look at the linked unit as soon as time permits!
I don't use TScaledLayout so I should be fine.

If the code there does what yopu say it does we should team up and
reporte the Keyboard Demo shipped with Delphi as buggy!
They shall not supply not properly working demos to us. ;-)

Greetings

Markus
Malcolm Taylor

Posts: 148
Registered: 7/16/01
Re: Understanding VirtualKeyboardDemo
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 16, 2015 1:50 PM   in response to: Markus Humm in response to: Markus Humm
Hi Markus
(sorry I got your name wrong)

I tried to read the vkbdhelper author's blog and the related comments
(using Google Translate) and managed to understand that he wrote it
because the sample demo was only a simple starting point.

He also says something along the line of .. his unit was only written
for Android, does not cover everything and he hopes that either EMB (or
new owner) will write a complete and tested helper for inclusion with
RAD Studio, or that a 3rd party developer will do so.

Malcolm
Dave Nottage

Posts: 1,850
Registered: 1/7/00
Re: Understanding VirtualKeyboardDemo
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 16, 2015 6:09 PM   in response to: Markus Humm in response to: Markus Humm
thanks for this valuable answer!

For what it's worth: I'm working on a revisit of something I developed a couple of years ago, which makes moving the controls way easier than in the demo. I plan to have it done before the end of the week; just have to sort out the Android part.

--
Dave Nottage [TeamB]
Malcolm Taylor

Posts: 148
Registered: 7/16/01
Re: Understanding VirtualKeyboardDemo
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 16, 2015 11:06 PM   in response to: Dave Nottage in response to: Dave Nottage
Dave Nottage wrote:

thanks for this valuable answer!

For what it's worth: I'm working on a revisit of something I
developed a couple of years ago, which makes moving the controls way
easier than in the demo. I plan to have it done before the end of the
week; just have to sort out the Android part.

Hi Dave

Yes, I tried your original component.
Have you had a look at the vkbdhelper unit mentioned in this thread?
It does not suffer from the 'float back down' issue you had.

Malcolm
Markus Humm

Posts: 5,113
Registered: 11/9/03
Re: Understanding VirtualKeyboardDemo
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 17, 2015 2:02 AM   in response to: Malcolm Taylor in response to: Malcolm Taylor
Malcolm Taylor wrote:
Dave Nottage wrote:

thanks for this valuable answer!

For what it's worth: I'm working on a revisit of something I
developed a couple of years ago, which makes moving the controls way
easier than in the demo. I plan to have it done before the end of the
week; just have to sort out the Android part.

Hi Dave

Yes, I tried your original component.
Have you had a look at the vkbdhelper unit mentioned in this thread?
It does not suffer from the 'float back down' issue you had.

Malcolm

Hello Malcom,

no big deal with my name, quite a few guys are are stuck in latin where they had (afaik) no letter k. ;-)
I tried that unit yesterday evening and it mostly works. I found one issue though with my Smartphone:
If I was on a screen where the content had to be moved up to acommodate for the keyboard and I rotated
the device to landscape everything was fine. It simply readjusted. If I rotated back to portrait it didn't
readjust again. I could manually scroll up the screen.

I don't yet fully understand his solution, but I haven't had a deep look at his source yet. I did a Google
translate translation of his comments which mostly makes sense and if wanted I could share that version
of the unit.

But I'd really like to get in touch with EMBT now so that they provide a clean solution for this issue as
their solution presented in that demo clearly doesn't cut it, at least compared with this one.

Anybody likes to help me formulating such a case?
Shall we directly point to that blog entry?

Best regards

Markus
Malcolm Taylor

Posts: 148
Registered: 7/16/01
Re: Understanding VirtualKeyboardDemo
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 17, 2015 6:12 AM   in response to: Markus Humm in response to: Markus Humm
Hi Markus

Let's see what Dave comes up with.
His TControlMover component had contributions from several developers
and it is thought to work for win32 and OSX/iOS.
It has known issues for Android but as Dave has undertaken to look at
it again I think it would be good to see if he can crack it.

If the community can show EMBT something that works for most purposes,
they may be prepared to put it through their testing with a view to
including an official solution in their code base. Developers
certainly need a solution for this matter.

Malcolm
Markus Humm

Posts: 5,113
Registered: 11/9/03
Re: Understanding VirtualKeyboardDemo
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 17, 2015 11:44 AM   in response to: Malcolm Taylor in response to: Malcolm Taylor
Am 17.11.2015 um 15:12 schrieb Malcolm Taylor:
Hi Markus

Let's see what Dave comes up with.
His TControlMover component had contributions from several developers
and it is thought to work for win32 and OSX/iOS.
It has known issues for Android but as Dave has undertaken to look at
it again I think it would be good to see if he can crack it.

If the community can show EMBT something that works for most purposes,
they may be prepared to put it through their testing with a view to
including an official solution in their code base. Developers
certainly need a solution for this matter.

Malcolm

Hello,

yes developers do need a solution for it.

Greetings

Markus
Markus Humm

Posts: 5,113
Registered: 11/9/03
Re: Understanding VirtualKeyboardDemo
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 19, 2015 10:35 AM   in response to: Malcolm Taylor in response to: Malcolm Taylor
Am 17.11.2015 um 15:12 schrieb Malcolm Taylor:
Hi Markus

Let's see what Dave comes up with.
His TControlMover component had contributions from several developers
and it is thought to work for win32 and OSX/iOS.
It has known issues for Android but as Dave has undertaken to look at
it again I think it would be good to see if he can crack it.

If the community can show EMBT something that works for most purposes,
they may be prepared to put it through their testing with a view to
including an official solution in their code base. Developers
certainly need a solution for this matter.

Malcolm

Hello,

could you please keep me updated on Dave's progress?

Greetings

Markus
Malcolm Taylor

Posts: 148
Registered: 7/16/01
Re: Understanding VirtualKeyboardDemo
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 19, 2015 3:50 PM   in response to: Markus Humm in response to: Markus Humm
Markus Humm wrote:

could you please keep me updated on Dave's progress?
I have just spotted this post by Dave:
http://delphi.radsoft.com.au/2015/11/moving-controls-into-view-when-the-virtual-keyboard-is-shown-revisited/
I will have a look at it soon.

Malcolm
Malcolm Taylor

Posts: 148
Registered: 7/16/01
Re: Understanding VirtualKeyboardDemo
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 7, 2015 2:16 AM   in response to: Markus Humm in response to: Markus Humm
Markus Humm wrote:

could you please keep me updated on Dave's progress?

I have tried Dave's sample and find it works about as well as the
Chinese alternative.
Dave has not yet responded to my feedback about the two matters that do
not work for me the way he claims.

For now I am using the Chinese version as it is slightly easier to
include (just add unit to uses).

But I can't help wondering why EMB would implement the Vkb without also
managing the visibility of the edit component. Seems like they did
only half the job. Maybe they simply could not make it work on all
platforms....!
Dave Nottage

Posts: 1,850
Registered: 1/7/00
Re: Understanding VirtualKeyboardDemo
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 22, 2015 6:43 PM   in response to: Malcolm Taylor in response to: Malcolm Taylor
Yes, I tried your original component.
Have you had a look at the vkbdhelper unit mentioned in this thread?

I'm aware of its existence, however I haven't had a look yet.

It does not suffer from the 'float back down' issue you had.

I'll be sure to check it out this week.

--
Dave Nottage [TeamB]
pepito62490 pep...

Posts: 1
Registered: 2/29/08
Re: Understanding VirtualKeyboardDemo
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 1, 2017 3:40 AM   in response to: Markus Humm in response to: Markus Humm
Today June 10, 2017.

What is the best solution?

Where download the latest version of the source code?

Thank you very much.

PS: Too bad that embarcadero is not natively solved this problem.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02