IME froze Button

Sinan Tuzcu

Well-Known Member
Licensed User
Longtime User
Hello,

I have this Code from IME Tutorial in my project and there are Problems.

original code from IME Tutorial:
B4X:
Sub Process_Globals

End Sub
Sub Globals   
    Dim IME As IME
    Dim EditText1 As EditText
    Dim btnHideKeyboard As Button
    Dim EditText2 As EditText
    Dim EditText3 As EditText
    Dim EditText4 As EditText
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("1")
    IME.Initialize("IME")
    IME.AddHeightChangedEvent
    IME_HeightChanged(100%y, 0) 'manually call this method to set the layout of EditText1 and btnHideKeyboard
    IME.AddHandleActionEvent(EditText2)
    IME.SetCustomFilter(EditText3, EditText3.INPUT_TYPE_NUMBERS, "0123456789.")
    IME.SetCustomFilter(EditText4, Bit.OR(EditText4.INPUT_TYPE_TEXT, 0x00080000), _ '0x0080000 is the flag of NO_SUGGESTIONS.
        "01234567890abcdef")
End Sub

Sub IME_HandleAction As Boolean
    Dim e As EditText
    e = Sender
    If e.Text.StartsWith("a") = False Then
        ToastMessageShow("Text must start with 'a'.", True)
        'Consume the event.
        'The keyboard will not be closed
        Return True
    Else
        Return False 'will close the keyboard
    End If 
End Sub

Sub IME_HeightChanged(NewHeight As Int, OldHeight As Int)
    btnHideKeyboard.Top = NewHeight - btnHideKeyboard.Height
    EditText1.Height = btnHideKeyboard.Top - EditText1.Top
End Sub

Sub Activity_Pause(UserClosed As Boolean)

End Sub
Sub btnShowKeyboard_Click
    'IME.ShowKeyboard(EditText2)
End Sub
Sub btnHideKeyboard_Click
    'IME.HideKeyboard
End Sub

I have put this code in an activity, where there is only two text boxes and a button. The problem is, that's the button while frozen until the keyboard disappears.

Here is my code in my Project:
B4X:
Sub Process_Globals

End Sub

Sub Globals
Dim IME As IME
    
    Dim EditText1 As EditText
    Dim Button1 As Button
    Dim EditText2 As EditText
    Dim phone1 As Phone

End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("haberyolla")
                
    phone1.SetScreenOrientation(-1)
    
    IME.Initialize("IME")
    IME.AddHeightChangedEvent
    IME_HeightChanged(100%y, 0) 
    StartService(OneSMS)

End Sub

Sub IME_HeightChanged(NewHeight As Int, OldHeight As Int)
    EditText2.Top = NewHeight - EditText2.Height
    Button1.Top = EditText2.Top
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event

 If KeyCode = KeyCodes.KEYCODE_BACK Then
    Activity.Finish
    StartActivity("Obstliste")
 End If

End Sub

Sub Button1_Click
Dim textnull As String
Dim link As String
Dim BName As String

If EditText1.Text="" Then 
Msgbox("Bitte gib eine Kategorie ein.","")
Return
End If


textnull = codlar.Left(EditText1.text,2)
For k = 1 To textnull.Length -1
If codlar.MidLengh(textnull, k, 1) = "G" OR textnull = "GB" Then
BName = su.EncodeUrl(Benutzername, "UTF8")
OneSMS.kime = codlar.mid(EditText1.text,2)
CallSubDelayed(OneSMS, "ciftsifir")
Return
End If

IME.HideKeyboard
Activity.Finish
StartActivity("Obstliste")

End Sub
 

Sinan Tuzcu

Well-Known Member
Licensed User
Longtime User
I think the listview was on the button and the listview is transparent, so I could not click this button.
 
Upvote 0
Top