I'm frustrated. Why are we able to write code that does not work? I find myself spending hours on things that should be simple. This is just one example
I tried several variations of this:
As you can see from the results below NOTHING returns a label or "label" (the labels are the ones that say City/State/Zip/etc.)
I found code from 2012 that says
Honestly, if I need to tag the labels or put them in an array I can do that but that is not the clean simple way and involves remembering to do it later when new controls are added.
This is a B4X pages project so it needs to work in B4A/i/J. It seems to work ok in B4i, haven't checked b4A, B4A returns the above.
So, what is the recommended procedure for reliably returning the type of view in B4A/i/J?
I tried several variations of this:
B4X:
For Each VV As View In GroupLbl.Parent.GetAllViewsRecursive
If VV Is Label Then
Dim V As Label = VV
Log(GetType(VV) & " " & V.Text)
If V.Text.StartsWith("Allow") Then V.Visible = False
V.TextColor = xui.Color_LightGray
End If
Next
As you can see from the results below NOTHING returns a label or "label" (the labels are the ones that say City/State/Zip/etc.)
B4X:
android.widget.EditText 00001 Anywhere Ave.
android.widget.TextView Address
android.widget.TextView Test2
android.widget.EditText MN
android.widget.TextView State
android.widget.EditText 99936985
android.widget.TextView Zip
android.widget.EditText Everyhere2
android.widget.TextView City
android.widget.TextView Allow Pictures
android.widget.TextView GeoFence
android.widget.Button Save Changes
android.widget.EditText Address Line 2 Test
android.widget.TextView Address 2
android.widget.TextView Comments
android.widget.EditText Comments Test
I found code from 2012 that says
If Is Label
doesn't work, use Gettype well, Ok, I did that but it doesn't work either as you can see from the above listing, So more research and I find code from 2015 that recommends If Is Label
again so I am thinking "is this now supposed to work? What am I missing?" The code above was VV As B4XView
so I am thinking that is the problem so i switched it.Honestly, if I need to tag the labels or put them in an array I can do that but that is not the clean simple way and involves remembering to do it later when new controls are added.
This is a B4X pages project so it needs to work in B4A/i/J. It seems to work ok in B4i, haven't checked b4A, B4A returns the above.
So, what is the recommended procedure for reliably returning the type of view in B4A/i/J?