iOS Question B4XFloatTextField, CLV and ResignFocus

fbritop

Active Member
Licensed User
Longtime User
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?

1595987046837.png
 

fbritop

Active Member
Licensed User
Longtime User
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
 
Upvote 0

fbritop

Active Member
Licensed User
Longtime User
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
 
Upvote 0

fbritop

Active Member
Licensed User
Longtime User
@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

1596113826581.png
 
Upvote 0

fbritop

Active Member
Licensed User
Longtime User
Yes I saw it, my question was: Why cant we use directly:

B4X:
FloatTextField.TextField.ResignFocus

I tried post #2 the first time with the method above, that obviously it was not listed, but I never thought of the workaround.
 
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
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
 
Last edited:
Upvote 0
Top