Sub Button1_Click
Dim p As B4XView = xui.CreatePanel("")
p.SetLayoutAnimated(0, 0, 0, 300dip, 200dip)
p.LoadLayout("MyDialog")
Dialog.PutAtTop = True
Dim rs As ResumableSub = Dialog.ShowCustom(p, "OK", "", "CANCEL")
txtFirstName.TextField.RequestFocus
IsDialogValid(txtFirstName.Text, txtLastName.Text)
Wait For (rs) Complete (Result As Int)
Dialog.PutAtTop = False
If Result = xui.DialogResponse_Positive Then
Dialog.Show($"Hello ${txtFirstName.Text} ${txtLastName.Text}"$, "OK", "", "")
End If
End Sub
Private Sub IsDialogValid (FirstName As String, LastName As String)
Dim ok As B4XView = Dialog.GetButton(xui.DialogResponse_Positive)
If FirstName.Length > 0 And LastName.Length > 0 Then
ok.Enabled = True
Else
ok.Enabled = False
End If
End Sub
Sub txtFirstName_TextChanged (Old As String, New As String)
IsDialogValid(New, txtLastName.Text)
End Sub
Sub txtLastName_TextChanged (Old As String, New As String)
IsDialogValid(txtFirstName.Text, New)
End Sub