LucaMs Expert Licensed User Longtime User Jul 19, 2017 #1 I have an invisible EditText; when I set it to visible I want to show an IME keyboard (which puts the focus on it). I used code similar to this: Code: Copy EditText1.Visible = True CallSubDelayed2(Me, "ShowKeybord", EditText1) Sub ShowKeybord(et As EditText) IMEKeyboard.ShowKeyboard(et) End Sub It works in debug mode; in release mode the EditText gets the focus but the sw keyboard is not shown. Writing a DoEvents before IMEKeyboard.ShowKeyboard(et), all work as expected. How to avoid DoEvents in this case?
I have an invisible EditText; when I set it to visible I want to show an IME keyboard (which puts the focus on it). I used code similar to this: Code: Copy EditText1.Visible = True CallSubDelayed2(Me, "ShowKeybord", EditText1) Sub ShowKeybord(et As EditText) IMEKeyboard.ShowKeyboard(et) End Sub It works in debug mode; in release mode the EditText gets the focus but the sw keyboard is not shown. Writing a DoEvents before IMEKeyboard.ShowKeyboard(et), all work as expected. How to avoid DoEvents in this case?
L LucianDesign Member Licensed User Longtime User Jul 19, 2017 #2 Did you tried Sleep(0) instead of DoEvents? Discussions on this: https://www.b4x.com/android/forum/threads/sleep-0-as-alternative-to-doevents.80127/ Upvote 0
Did you tried Sleep(0) instead of DoEvents? Discussions on this: https://www.b4x.com/android/forum/threads/sleep-0-as-alternative-to-doevents.80127/
LucaMs Expert Licensed User Longtime User Jul 19, 2017 #3 LucianDesign said: Did you tried Sleep(0) instead of DoEvents? Click to expand... Ops... no, I didn't. Since Sleep returns control to calling routines, I "fear" flow problems, so I try to avoid also Sleep. In this case, however, the calling routine is a view event routine, so it works without risk. Thank you. Upvote 0
LucianDesign said: Did you tried Sleep(0) instead of DoEvents? Click to expand... Ops... no, I didn't. Since Sleep returns control to calling routines, I "fear" flow problems, so I try to avoid also Sleep. In this case, however, the calling routine is a view event routine, so it works without risk. Thank you.
tigrot Well-Known Member Licensed User Longtime User Jul 19, 2017 #4 DoEvents as far as I know allows next events to be processed. Flow is lost in any case. I never use this feature in any OS when on multi thread. Upvote 0
DoEvents as far as I know allows next events to be processed. Flow is lost in any case. I never use this feature in any OS when on multi thread.
LucaMs Expert Licensed User Longtime User Jul 19, 2017 #5 tigrot said: DoEvents as far as I know allows next events to be processed. Flow is lost in any case. I never use this feature in any OS when on multi thread. Click to expand... VB.Net DoEvents does not return control to the calling routine, it allows the system to process events. B4a DoEvents is different. Upvote 0
tigrot said: DoEvents as far as I know allows next events to be processed. Flow is lost in any case. I never use this feature in any OS when on multi thread. Click to expand... VB.Net DoEvents does not return control to the calling routine, it allows the system to process events. B4a DoEvents is different.
Erel B4X founder Staff member Licensed User Longtime User Jul 20, 2017 #6 The CallSubDelayed is not needed here. It should be: Code: Copy EditText1.Visible = True Sleep(50) IMEKeyboard.ShowKeyboard(et) Upvote 0
The CallSubDelayed is not needed here. It should be: Code: Copy EditText1.Visible = True Sleep(50) IMEKeyboard.ShowKeyboard(et)