The forum is in read only mode.

  • Page:
  • 1

TOPIC: Cannot hide virtual keyboard

Cannot hide virtual keyboard 3 years 3 months ago #3686

This is a beginner's question. I have been using Appmethod for just on 20 days, and progressing reasonably OK.

However, the virtual keyboard in Android has me stumped.

It is pretty much a standard expectation with an Android app, that if focus is in an edit or memo box, if you tap somewhere else, anywhere, it will take focus out of the edit box and the keyboard will disappear.

Not so with apps created with Appmethod. Once I have tapped in a TEdit or TMemo box, I cannot get focus out of them, and cannot get rid of the keyboard.

Except in TEdit, set the RETURN key to terminate an entry, and the keyboard will disappear.

But TMemo, no way to get the keyboard to go away.

I have read all over the place, found one "solution" to run "Focus = NULL;", which I put into a speedbutton to test, but it had no effect.

There was one mention that a call to native Java functions is required... but surely not. There must be some generic way to take focus out of a TEdit or TMemo box!

If anyone else wants to verify this behaviour, look at the MobileControls sample that ships with Appmethod 1.16. I am using C++.

There is probably some simple solution here. Could someone kindly advise me?

Note, I have an MLais M52 phone with Android 4.4.4.

Cannot hide virtual keyboard 3 years 3 months ago #3692

I have partly answered my own question. I found that "Focused=NULL;" does work, I tried it incorrectly before.

On the form with a TEdit and a TMemo, I also placed a button, and run this when click it:

void __fastcall TForm3::ImageNewVKClick(TObject *Sender)
//IFMXVirtualKeyboardService *virtKeyboard;
// ...get "access violation"
Focused = NULL;

Note, I found HideVirtualKeyboard() method in the docs, but that gives an "access violation".

What I want to do though, is be able to touch anywhere outside the edit boxes (and not on any other control), and have focus removed from the edit box.

As per normal Android app behaviour.

Does anyone know, anywhere I can hook into when touch the screen not on an active component and run that "Focused=NULL;"?

Cannot hide virtual keyboard 3 years 2 months ago #3706

Hi Barry,

You could implement an OnTap event handler on the form. In that handler, you could call the HideVirtualKeyboard method of the IFMXVirtualKeyboardService platform service.

Looking at your code sample, it looks like you are not obtaining a reference to the platform service correctly, which is why you are seeing an AV when calling HideVirtualKeyboard.

For the proper way to obtain a reference to the platform service, see the documentation here:


The following user(s) said Thank You: Omar
  • Page:
  • 1
Moderators: April Anne