How can I check if both of the two B4XFloatTextField have text?
When the user clicks "OK", I must check that data has been entered each of the B4XFloatTextField.
If either is empty, I display a ToastMessage.
I must then set focus on the B4XFloatTextField that is empty.
My code (that does not work)
When the user clicks "OK", I must check that data has been entered each of the B4XFloatTextField.
If either is empty, I display a ToastMessage.
I must then set focus on the B4XFloatTextField that is empty.
My code (that does not work)
B4X:
Sub CheckForUser
DB.Initialize(DBFileDir, DBFileName, True)
Dim Cursor As Cursor
Cursor = DB.ExecQuery("SELECT * FROM reg")
If (Cursor.RowCount < 1) Then
Log("No USER")
dialog.Initialize(Activity)
dialog.Title = "Login"
Dim p As B4XView = xui.CreatePanel("")
p.SetLayoutAnimated(0, 0, 0, 300dip, 150dip)
p.LoadLayout("CustomDialog")
dialog.PutAtTop = True 'put the dialog at the top of the screen
Wait For (dialog.ShowCustom(p, "OK", "", "CANCEL")) Complete (Result As Int)
If Result = xui.DialogResponse_Positive Then
If (txtUsername.Text = "") Then
ToastMessageShow("You MUST enter your Username", False)
End If
If (txtPassword.Text = "") Then
ToastMessageShow("You MUST enter your Password", False)
End If
If (txtUsername.Text <> "" And txtPassword.Text <> "") Then
dialog.Show("Welcome", "OK", "", "")
currentUser = txtUsername.Text
currentPwd = txtPassword.text
getUser(currentUser)
End If
End If
If Result = xui.DialogResponse_Cancel Then
ToastMessageShow("You MUST Login to Continue", True)
Sleep(3000)
ExitApplication
End If
End If
If (Cursor.RowCount > 0) Then
Log("GOT USER")
' Get fleet from SQLite table "reg"
' getFleet
End If
End Sub