I have a TabStrip with 3 tabs, each tab has it´s own CLV, the first panel of the CLV has a B4XFloatTextField.
When I click over the B4XFloatTextField, the keyboard appears (which I use to filter the CLV). When I click on a panel of the CLV (to see master/detail info), although I request pageXXX.ResignFocus (event on the panel_click sub from the CLV. The keyboard wont disappear. I´m missing something when I combine these 3 elements and try to use ResignFocus?
It didnt work. I´m not sure if it has something to do but the FloatTextField are created from a same BAL file on each CLV. xTextFieldSearch is the layout file with a single FloatTextField
B4X:
pt.Initialize("")
pt.SetLayoutAnimated(0,1,30dip,0,Main.ancho-50dip,50dip)
pt.LoadLayout("xTextFieldSearch")
globalMap.Put("txtSearchMail", xTextFieldSearch)
Dim fe As B4XFloatTextField = globalMap.Get("txtSearchMail")
fe=xau.createXTextField(fe, "Buscar", "")
fe.Tag="MAIL"
fe.TextField.SetColorAndBorder(col.clrLight, 0,0,10dip)
fe.Update
It's kind of hard to isolate a single code module (project is arround 15K lines). But what it made it was to call:
B4X:
pTab.SetPages(TabPages)
where pTab is TabStrip and tabPages is a List with the three tabs (as pages). Calling this method hide the keyboard. Also when I have the same layout without TabStrip, hidding the keyboard can be done with ResignFocus so I asume it has something to do with TabStrip
Page.ResignFocus goes over the views recursively and resigns the focus from all of them. I guess that in your case it fails to reach the relevant view.
The solution should be simple, get the TextField yourself and call TextField.ResignFocus.
@Erel that was the first thing I tried, but I could never found ResignFocus. I now can do it in a delegate way, but should the ResignFocus method be available from B4XFloatTextField.TextField?
B4X:
Dim fe As B4XFloatTextField = globalMap.Get("txtSearchDelivery")
Dim tf As TextField=fe.TextField
tf.ResignFocus
TextField returns B4XView. To do what you want, it's neccessary to make separate properties, for example, TextField As TextField, TextView As TextView etc.
But this obviously conficts with cross-platform concept.
Meanwhile you can make simple functions, for example:
B4X:
Sub TextFieldFrom (AnyB4XFloatTextField As B4XFloatTextField) As TextField
Return AnyB4XFloatTextField.TextField
End Sub
Sub TextViewFrom (AnyB4XFloatTextField As B4XFloatTextField) As TextView
Return AnyB4XFloatTextField.TextField
End Sub
and to use TextFieldFrom (FloatTextField).ResignFocus or (if multiline is true) TextViewFrom (FloatTextField).ResignFocus