Android Question IME with B4xView

Rusty

Well-Known Member
Licensed User
Longtime User
Is there a way to use the IME library with B4xViews or is there a B4xView replacement for IME?
Also, is there a way to calculate the soft keyboard height or top?
Thanks,
Rusty
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Everything is possible with B4XViews. B4XView is a thin wrapper above the exact same controls. If needed you can cast it to the original control.

What do you want to do with the IME library and B4XViews?

Also, is there a way to calculate the soft keyboard height or top?
You need to handle the HeightChanged event. The new activity height is passed as a parameter.
 
Upvote 0

Rusty

Well-Known Member
Licensed User
Longtime User
I need to place a panel with other views above the top of the keyboard on a variety of device sizes and orientations.
I have use the b4xView in the code and when I try to: IMEX.showkeyboard(vw) the compiler complains that types don't match.
After your above post, I tried to recast the b4xFloatTextField to an edittext and it complains the types don't match. How do I recast a b4xfloattextfield to the proper type?
B4X:
Sub ShowKeyboard(B4xVw As B4XFloatTextField)
    Dim vw As EditText = B4xVw                          <---<< it complains about the type here Types do not match (warning #22)
    IMEX.ShowKeyboard(vw)
End Sub

Sub HideKeyboard
    IMEX.HideKeyboard
End Sub

Sub IMEX_HeightChanged (NewHeight As Int, OldHeight As Int)
    ' NewHeight is the keyboard.top
    Dim KeyboardVisible As Boolean
    KeyboardVisible = (NewHeight < OldHeight)

    If Not(KeyboardVisible) Then
        ' Set here the EditText1 original top position
    Else
        If NewHeight < (pnlOptions.Top + pnlOptions.Height) Then
            pnlOptions.Top = NewHeight - pnlOptions.Height
        End If
    End If
End Sub
 
Upvote 0

Rusty

Well-Known Member
Licensed User
Longtime User
oops! Ok that fixed that error.
As always your help is greatly appreciated.
Rusty
 
Upvote 0
Top