I have 5 components without my designer.
I want to modify them through a function, the problem and when identifying a customlistview, for some reason I can't know what type of component it is.
I want to modify them through a function, the problem and when identifying a customlistview, for some reason I can't know what type of component it is.
B4X:
Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Private Button1 As B4XView
Private EditText1 As B4XView
Private Label1 As B4XView
Private CustomListView1 As CustomListView
Private B4XFloatTextField1 As B4XFloatTextField
End Sub
Public Sub Initialize
End Sub
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
End Sub
Private Sub B4XPage_Appear
formatar_campos
End Sub
Private Sub Button1_Click
CustomListView1.AddTextItem(EditText1.Text & CRLF & B4XFloatTextField1.Text,Null)
End Sub
Private Sub formatar_campos
'For Each v As B4XView In Root.GetAllViewsRecursive
For i=0 To Root.NumberOfViews-1
Dim v As B4XView = Root.GetView(i)
If v Is CustomListView Then
Log("CustomListView")
Dim v3 As CustomListView = v
v3.AsView.Color=xui.Color_Blue
else If v.Tag Is CustomListView Then
Log("CustomListView")
Dim v3 As CustomListView = v
v3.AsView.Color=xui.Color_Red
Else If v.Tag Is B4XFloatTextField Then
Log("B4XFloatTextField")
Dim v2 As B4XFloatTextField = v.Tag
v2.TextField.SetColorAndBorder(xui.Color_Black,0,0,10dip)
v2.TextField.TextColor=xui.Color_White
v2.TextField.TextSize=18
v2.TextField.SetTextAlignment("CENTER","CENTER")
v2.Update
Else If v Is EditText Then
Log("EditText")
v.SetColorAndBorder(xui.Color_LightGray,0,0,10dip)
v.TextColor=xui.Color_DarkGray
v.TextSize=18
v.SetTextAlignment("CENTER","CENTER")
Else If v Is Button Then
Log("Button")
v.SetColorAndBorder(xui.Color_Green,0,0,10dip)
v.TextColor=xui.Color_White
v.TextSize=22
v.SetTextAlignment("CENTER","CENTER")
Else If v Is Label Then
Log("Label")
v.Color=xui.Color_Transparent
v.TextColor=xui.Color_Red
v.TextSize=18
v.SetTextAlignment("CENTER","CENTER")
End If
Next
End Sub