I have a problem with textfield . There is a textfield in my app added to scrollpane , this textfield is sometimes selected by itself altough I do nothing , it gets the focus and the pointer is blinking at the textfield and ready to be entered a value. I only have this realted to textfield :
B4X:
Sub txtadet_FocusChanged (HasFocus As Boolean)
Dim txt As TextField=Sender
If HasFocus=False Then
txtadet(txt.Tag).Text=txtadet(txt.Tag).Text.Replace(",",".")
kvsmycoins.Put(listmycoins.Get(txt.Tag),txtadet(txt.Tag).Text)
mycoinsdegerbul
End If
End Sub
this sub is for when user changes a value it stores in kvs.
I tried this , I have added a textfield which is inbivisible and put:
txtinvisible.requestfocus at appstart , but still other textfields getting a focus .
Calling RequestFocus in appstart may not always behave as you expect. The focus is requested, but may not be given. I've found in the past that creating a sub and using CallSubDelayed is more consistent.
B4X:
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("1") 'Load the layout file.
MainForm.Show
CallSubDelayed2(Me,"RequestFocus",tfHidden)
End Sub
Private Sub RequestFocus(tf As TextField)
tf.RequestFocus
End Sub
Calling RequestFocus in appstart may not always behave as you expect. The focus is requested, but may not be given. I've found in the past that creating a sub and using CallSubDelayed is more consistent.
B4X:
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("1") 'Load the layout file.
MainForm.Show
CallSubDelayed2(Me,"RequestFocus",tfHidden)
End Sub
Private Sub RequestFocus(tf As TextField)
tf.RequestFocus
End Sub
Both of these are working thanks for help. Previously , with Don's suggestion , I made the textfield visible but its parent was invisible that was the reason it did not work.
Both are just fine ! thanks very much