The below crashes at Line 67 which is: IsDialogValid(New, txtLastName.Text)
java.lang.RuntimeException: Class instance was not initialized (b4xfloattextfield)
I am attaching the full project:
java.lang.RuntimeException: Class instance was not initialized (b4xfloattextfield)
B4X:
Sub Globals
Private txtFirstName As B4XFloatTextField
Private txtLastName As B4XFloatTextField
Private Dialog As B4XDialog
Private xui As XUI
Private Button1 As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1") ''has only button1
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
Dialog.Initialize(Activity)
Dialog.Title = "First and last Name"
Dim p As B4XView = xui.CreatePanel("")
p.SetLayoutAnimated(0, 0, 0, 300dip, 200dip)
p.LoadLayout("MyDialog") 'has both B4XFloatTextField B4Xviews
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($"Je m'appelle ${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
I am attaching the full project:
Attachments
Last edited: