I have been reading in the forums and understand the ForceDone set to True will hide the keyboard after information is entered in the EditText. I understand that it may be a limitation, yes?
Thanks,
R
Erel, did get the first Beta out. The B4A package cut 2/3's of my time off having to utilize Eclipse. Now cleaning it up a bit and starting on the next app. Thanks for you support and the team as well.
I have the ForceDone set in the designer for the EditText item but it does not hide the keyboard. I can hit the back button to do so but I don't want to have the user do this.
I am not sure I understand you image post. I ran the app and yes I have a Done but I do not get any feedback on it. I have the Force Done - True set in the EditText item in Designer.
I use it to pop up the keyboard when a view (like an edittext) gets focus and I hide the keyboard when it loses focus
B4X:
Sub etMenuItem_FocusChanged (HasFocus As Boolean)
u.SetFocus(etMenuItem, HasFocus, False, IME)
End Sub
in my utils code module named u :
B4X:
Sub SetFocus(obj As Object, hasfocus As Boolean, updatedouble As Boolean, myIME As IME)
If obj Is EditText Then
Dim et As EditText
et = obj
If hasfocus Then
et.SelectAll
myIME.ShowKeyboard(et)
Else
If updatedouble Then et.Text = FixDouble(et.Text)
myIME.HideKeyboard
End If
Else If obj Is AutoCompleteEditText Then
Dim ace As AutoCompleteEditText
ace = obj
If hasfocus Then
ace.SelectAll
myIME.ShowKeyboard(ace)
Else
myIME.HideKeyboard
End If
End If
End Sub
@Ricky: I tried your code where I assumed that etMenuItem is the event name for all the editetxt views you wanted to work with. I replaced it with my event name which is MyEdit. It returned the following error: Error description: Undeclared variable 'myedit' is used before it was assigned any value.
Occurred on line: 991
u.SetFocus(MyEdit, Hasfocus, False, IME)
I hope you correct my thinking.
Thanks
@mahares - I code each FocusChanged event individually.
So in my example the edittext is etMenuItem and of course the FocusChanged event is tied to it.
For other edittexts they have their own FocusChanged events.
I need to do it that way because if one of them has a 2 digit double it gets corrected on lost focus. This means if I enter 12 it displays as 12.00 or if 12.3 then shows as 12.30
can you post all of your code please?
From what you posted it looks like myedit isn't declared
Becaue I have several edittext views to do that to, I obviously could not declare that sub for each view. Therefore I did it using the Event name and the Sender keyword. And of course it works now. There is a jerking motion every time as it moves from box to box because it has to run the 'u' code module every time. The solution is more suitable when you do not have many editetxt views to apply it too. Below is the working code if someone wants to apply to several views. MyEdit is the event name for all concerned edittext view:
B4X:
Sub MyEdit_FocusChanged(Hasfocus As Boolean)
Dim Send As EditText
Send=Sender
u.SetFocus(Send, Hasfocus, False, IME)
End Sub
Thanks Ricky and keep that sharp brain and beautiful taxi tuned up.