Hidekeyboard and inputdialog problem

Jack Cole

Well-Known Member
Licensed User
Longtime User
I'm trying to hide the keyboard after a user inputs their name with an inputdialog.

For example:

B4X:
result=i.Show("Enter your name for the top scores list.","Save scores?","OK","","No Thanks",Null)
dim p as phone
p.HideKeyboard(Activity)

The trouble is, it doesn't hide the keyboard.

Am I doing something wrong?
 

JesseW

Active Member
Licensed User
Longtime User
I was able to achieve some success hiding the keyboard that was raised by agrahams custom dialogs by placing a DoEvents before and after the ph.HideKeyboard statement. And it also seemed to help a little to do a little processing, like checking the validity and format of an entered number, before trying to hide it. Like this

B4X:
   DoEvents
   ph.HideKeyboard(Activity)
   DoEvents

Erel, is there a chance you might include ph.ShowKeyboard in your next release?
Andrew, would you be so kind to show us a ShowKeyboard workaround using your Reflection object?

Many thanks :)
 
Last edited:
Upvote 0

kolbe

Active Member
Licensed User
Longtime User
It is not possible to use HideKeyboard with a keyboard that was added for a dialog. This is a limitation of dialogs.

The workaround I used to this is using the keygen library to send a 4. It works on a separate thread but basically you send yourself a back_key keypress. This should hide the keyboard. Perhaps other devices could use something other than 4, so use the keypress sub to see what your back key generates.
 
Upvote 0
Top