iOS Question (SOLVED) How do I hide the keyboard

walterf25

Expert
Licensed User
Longtime User
Hi all, i can't seem to get this working, nothing that i've tried so far is working, I have a scrollview that loads a layout with a few image views one textbox and two buttons, I needed to have the keyboard not block the textfield so i used Erel's code.

B4X:
Sub pg_KeyboardStateChanged (Height As Float)
    If Height > 0 Then
        signscv.ScrollTo(0, signscv.ScrollOffsetY + Height, True)
    End If
End Sub

This code works great as it doesn't block the texfield where the user needs to enter their name, the problem now is that I can't get the keyboard to hide, i've found a couple of solutions on the forum but none of them seem to work, i was wondering if anyone has a better suggestion on how to do this as it's driving me nuts.

at the moment i'am resigning the focus on the page, but that is not working either.

Regards,
Walter
 

walterf25

Expert
Licensed User
Longtime User
Solved it, i used the following code inside the textfield EnterPressed event

B4X:
Sub txtcustname_EnterPressed
    Log("entered pressed")
    txtcustname.RequestFocus
    txtcustname.ResignFocus
    signscv.ScrollTo(0, -signscv.ScrollOffsetY, False)  ''sets the scrollview back to it's original place.
End Sub

Walter
 
Upvote 0
Top