F FrankDev Active Member Licensed User Longtime User Apr 2, 2018 #1 hello I use the Dialog 2017 lib with a own layout >Wait For (sf) Dialog_Ready (pnl As Panel) >pnl.LoadLayout("test") ..... this layout has an input field. when I click this the keyboard appears. (ok) if I press a button now e.g. Cancel and try to close the keyboard, it doesn't work. Wait For (sf) Dialog_Result(res As Int) If res = DialogResponse.POSITIVE Then IME.HideKeyboard ... I put a sleep(100) in front of the IME.HideKeyboard it works. I'm sure there's a better solution than with sleep regards Frank
hello I use the Dialog 2017 lib with a own layout >Wait For (sf) Dialog_Ready (pnl As Panel) >pnl.LoadLayout("test") ..... this layout has an input field. when I click this the keyboard appears. (ok) if I press a button now e.g. Cancel and try to close the keyboard, it doesn't work. Wait For (sf) Dialog_Result(res As Int) If res = DialogResponse.POSITIVE Then IME.HideKeyboard ... I put a sleep(100) in front of the IME.HideKeyboard it works. I'm sure there's a better solution than with sleep regards Frank
Erel B4X founder Staff member Licensed User Longtime User Apr 3, 2018 #2 Please use [code]code here...[/code] tags when posting code. Upvote 0
F FrankDev Active Member Licensed User Longtime User Apr 3, 2018 #3 it is about the following example as described in #1. https://www.b4x.com/android/forum/t...-2017-custom-dialogs-and-async-methods.80204/ Dialog with multiple text input fields. (without spinner) clicking on the text field opens the keyboard. As far as ok click on one of the buttons (eg. Cancel or ok) the following is triggered. Code: Copy Wait For (sf) Dialog_Result(Result As Int) If Result = DialogResponse.POSITIVE Then IME.HideKeyboard 'do something End If If the dialogue disappears, I also want the Hide keyboard. But that's not the way it works. with the above code this does not work when I insert a sleep(100) it works Code: Copy Wait For (sf) Dialog_Result(Result As Int) If Result = DialogResponse.POSITIVE Then sleep(100) IME.HideKeyboard 'do something End If but the sleep(100) is certainly not really good Last edited: Apr 3, 2018 Upvote 0
it is about the following example as described in #1. https://www.b4x.com/android/forum/t...-2017-custom-dialogs-and-async-methods.80204/ Dialog with multiple text input fields. (without spinner) clicking on the text field opens the keyboard. As far as ok click on one of the buttons (eg. Cancel or ok) the following is triggered. Code: Copy Wait For (sf) Dialog_Result(Result As Int) If Result = DialogResponse.POSITIVE Then IME.HideKeyboard 'do something End If If the dialogue disappears, I also want the Hide keyboard. But that's not the way it works. with the above code this does not work when I insert a sleep(100) it works Code: Copy Wait For (sf) Dialog_Result(Result As Int) If Result = DialogResponse.POSITIVE Then sleep(100) IME.HideKeyboard 'do something End If but the sleep(100) is certainly not really good
Erel B4X founder Staff member Licensed User Longtime User Apr 3, 2018 #4 FrankDev said: but the sleep(100) is certainly not really good Click to expand... In some cases it is the only solution. Another option is to disable the EditText. It will also hide the keyboard. Upvote 0
FrankDev said: but the sleep(100) is certainly not really good Click to expand... In some cases it is the only solution. Another option is to disable the EditText. It will also hide the keyboard.
Emme Developer Well-Known Member Licensed User Longtime User Apr 3, 2018 #5 The same problem happened to me today. I solved this issue in this way Code: Copy Wait For Dialog_Result (Result As Int) txt.Enabled = False txt.Enabled = True If Result = DialogResponse.POSITIVE then 'what you need End If Sleep(0) Dim ph As Phone ph.HideKeyboard(Activity) I figured out that enabling and disabling the EditText will close the keyboard when you click on button (without these for me doesn't work) Upvote 0
The same problem happened to me today. I solved this issue in this way Code: Copy Wait For Dialog_Result (Result As Int) txt.Enabled = False txt.Enabled = True If Result = DialogResponse.POSITIVE then 'what you need End If Sleep(0) Dim ph As Phone ph.HideKeyboard(Activity) I figured out that enabling and disabling the EditText will close the keyboard when you click on button (without these for me doesn't work)
F FrankDev Active Member Licensed User Longtime User Apr 3, 2018 #6 Code: Copy If res = DialogResponse.POSITIVE Then ' Sleep(100) ' IME.HideKeyboard dlgTb.Enabled = False else if res = DialogResponse.CANCEL Then the enable = false worked well for me Upvote 0
Code: Copy If res = DialogResponse.POSITIVE Then ' Sleep(100) ' IME.HideKeyboard dlgTb.Enabled = False else if res = DialogResponse.CANCEL Then the enable = false worked well for me