Hi,
I have a panel with multiple checkboxes and edittexts. Each chkbox has a tag that corresponds with a matching edittext. When I check or uncheck the chkbox I would like for the matching edittext to be enabled or disabled. That part I seem to have figured out (with help of the forum).
I would also like for the matching edittext text to be cleared when the chkbox is unchecked and the edittext is disabled. That's where I'm having problems.
Thanks in advance
I have a panel with multiple checkboxes and edittexts. Each chkbox has a tag that corresponds with a matching edittext. When I check or uncheck the chkbox I would like for the matching edittext to be enabled or disabled. That part I seem to have figured out (with help of the forum).
I would also like for the matching edittext text to be cleared when the chkbox is unchecked and the edittext is disabled. That's where I'm having problems.
B4X:
Sub chkExpPU_CheckedChange(Checked As Boolean)
Dim chkPU As CheckBox=Sender
Log(chkPU.Tag)
For Each v As View In pnlPU.GetAllViewsRecursive
' Dim edt As EditText 'if I uncomment this I get "variable 'edt' was not initialized"
' edt.Initialize(edt) 'so I added this & get "variable converted to string" error
If v Is EditText And v.Tag=chkPU.Tag Then
If chkPU.Checked Then
v.Enabled=True
' edt.Enabled=True 'so I commented this out
Else
' edt.Text="" 'so I commented this out
' edt.Enabled=False 'so I commented this out
v.Enabled=False
End If
End If
Next
End Sub
Thanks in advance