iOS Question [RESOLVED] - CLV + Page1_KeyboardStateChanged

Jmu5667

Well-Known Member
Licensed User
Longtime User
Hello

I have a CLV with many items. Each item is actually a layout. If I scroll down my list and give focus to a textfield the keyboard pops, the following code is executed:

B4X:
Sub pg_KeyboardStateChanged (Height As Float)

    Dim v As View = clvSettings.AsView
    clvSettings.GetBase.Height = Min(v.CalcRelativeKeyboardHeight(Height), pg.RootPanel.Height - 10dip - clvSettings.GetBase.Top)
    
End Sub

When the user ends the input by pressing the Accept Button (B4XFloatTextField) the keyboard disappears, but, the CLV returns to the very top. I have tried clvSettings.sv.ScrollViewOffsetY = LastRecordedOffsetY but is does not scroll.

Any suggestions ?

Regards

John
 

Jmu5667

Well-Known Member
Licensed User
Longtime User
This is the Fix

B4X:
Sub pg_KeyboardStateChanged (Height As Float)

    ' // https://www.b4x.com/android/forum/threads/xcustomlistview-doesnt-have-the-method-calcrelativekeyboardheight.112175/#post-699655
    Dim p As View = clvSettings.AsView.Parent.Parent
    Dim rel As Int = p.CalcRelativeKeyboardHeight(Height)
    If rel = 0 Then rel = clvSettings.AsView.Height
    clvSettings.sv.Height = Min(rel, clvSettings.AsView.Height)

End Sub
 
Upvote 0

ddefrain

Member
Licensed User
Longtime User
This is the Fix

B4X:
Sub pg_KeyboardStateChanged (Height As Float)

    ' // https://www.b4x.com/android/forum/threads/xcustomlistview-doesnt-have-the-method-calcrelativekeyboardheight.112175/#post-699655
    Dim p As View = clvSettings.AsView.Parent.Parent
    Dim rel As Int = p.CalcRelativeKeyboardHeight(Height)
    If rel = 0 Then rel = clvSettings.AsView.Height
    clvSettings.sv.Height = Min(rel, clvSettings.AsView.Height)

End Sub
Thank's it works like a charm ?
Best Regards
 
Upvote 0
Top