B4J Question RequestFocus

BeneBarros

Active Member
Licensed User
Longtime User
have a strange problem
I have 3 TextField where t1, t2 AND t3.
Initially t2 Is disabled.
't1 typing In "00000" enables AND setfocus In t2
'Results focus on t2 AND t3
dual focus
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private t1 As TextField
Private t2 As TextField
Private t3 As TextField
Private FSize As Int
Private Ct As Int
End Sub

Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("t") 'Load the layout file.
MainForm.Show
t2.Enabled=False
End Sub

Sub t3_FocusChanged (HasFocus As Boolean)
If HasFocus Then
Log("t3 in")
Else
Log("t3 out")
End If
End Sub

Sub t2_FocusChanged (HasFocus As Boolean)
If HasFocus Then
Log("t2 in")
Else
Log("t2 out")
End If
End Sub

Sub t1_FocusChanged (HasFocus As Boolean)
If HasFocus Then
FSize=5
Else
ckField
End If
End Sub

Private Sub ckField
If t1.Text = "00000" Then
t2.Enabled=True
t2.RequestFocus
Else
'blablabla
End If
End Sub
 

Attachments

  • test.jpg
    test.jpg
    47.1 KB · Views: 247
  • test.zip
    1.1 KB · Views: 202
Top