merlin2049er Well-Known Member Licensed User Longtime User Aug 28, 2013 #1 I looked at some of the examples in the pdf and online but couldn't quite figure out how to apply changes to "x" number of labels in a for next loop. Just like to clean up my code a bit.
I looked at some of the examples in the pdf and online but couldn't quite figure out how to apply changes to "x" number of labels in a for next loop. Just like to clean up my code a bit.
thedesolatesoul Expert Licensed User Longtime User Aug 28, 2013 #2 Code: Copy For i = 0 To Activity.NumberOfViews - 1 If Activity.GetView(i) Is Label Then Dim lbl As Label lbl = Activity.GetView(i) End If Next Upvote 0
Code: Copy For i = 0 To Activity.NumberOfViews - 1 If Activity.GetView(i) Is Label Then Dim lbl As Label lbl = Activity.GetView(i) End If Next
Erel B4X founder Staff member Licensed User Longtime User Aug 28, 2013 #3 Note that this loop will also "catch" Button, EditText, CheckBox and RadioButton as they are all subclasses of Label. Upvote 0
Note that this loop will also "catch" Button, EditText, CheckBox and RadioButton as they are all subclasses of Label.
thedesolatesoul Expert Licensed User Longtime User Aug 28, 2013 #4 Then how about this, Code: Copy For i = 0 To Activity.NumberOfViews - 1 If Activity.GetView(i) Is Button OR _ Activity.GetView(i) Is EditText OR _ Activity.GetView(i) Is CheckBox OR _ Activity.GetView(i) Is RadioButton Then Else If Activity.GetView(i) Is Label Then Dim lbl As Label lbl = Activity.GetView(i) End If Next Upvote 0
Then how about this, Code: Copy For i = 0 To Activity.NumberOfViews - 1 If Activity.GetView(i) Is Button OR _ Activity.GetView(i) Is EditText OR _ Activity.GetView(i) Is CheckBox OR _ Activity.GetView(i) Is RadioButton Then Else If Activity.GetView(i) Is Label Then Dim lbl As Label lbl = Activity.GetView(i) End If Next
merlin2049er Well-Known Member Licensed User Longtime User Aug 28, 2013 #5 sweet. ' oloron font Dim i As Int For i = 0 To Activity.NumberOfViews - 1 If Activity.GetView(i) Is Label Then Dim lbl As Label lbl = Activity.GetView(i) lbl.Typeface = oloron End If Next That works fine. I loaded the font in activity_create (first time). Upvote 0
sweet. ' oloron font Dim i As Int For i = 0 To Activity.NumberOfViews - 1 If Activity.GetView(i) Is Label Then Dim lbl As Label lbl = Activity.GetView(i) lbl.Typeface = oloron End If Next That works fine. I loaded the font in activity_create (first time).
B beni_feld Member Licensed User Longtime User Aug 28, 2013 #6 You can use the Tag property for each label and set it by the designer to "lbl" Now use the Tag property to identify the label: Code: Copy Dim vi As View Dim lb As Label For i=0 To activity.NumberOfViews-1 vi=Activity.GetView(i) If vi.Tag="lbl" Then lb=activity.GetView(i) 'lb.Color=Colors.Transparent 'lb.TextColor=Colors.RGB(0,0,139) end if Next BN Upvote 0
You can use the Tag property for each label and set it by the designer to "lbl" Now use the Tag property to identify the label: Code: Copy Dim vi As View Dim lb As Label For i=0 To activity.NumberOfViews-1 vi=Activity.GetView(i) If vi.Tag="lbl" Then lb=activity.GetView(i) 'lb.Color=Colors.Transparent 'lb.TextColor=Colors.RGB(0,0,139) end if Next BN