Android Question Panel in a panel in a Panel

deltacode

Member
Licensed User
Longtime User
Hi All,

This is a great community and i have found many answers but now i have hit a problem and cant find the answer.

On my activity i am adding panels to a scrollview. to do this im calling code from a module for each line so i cant just declare the controls in the activity globals:

B4X:
Sub PopulateLine
    Dim P As Panel
    P.Initialize("pnlSVLine")
    P.LoadLayout("Line")

    Dim x As Int = 0
    For x = 0 To P.NumberOfViews - 1
        Dim vw As View = P.GetView(x)
    Next
End Sub

The layout is a panel called Panelbackground
which has another panel on it called PanelLineBack
PanelLineBack has another panel on it called PanelCollection
and finally on PanelCollection is a label called lblDetails

I was hoping with the above code i could cycle through all of the views on the layout, but the above code only returns one view on the panel that is Panelbackground.

How can i get to the label lblDetails to populate this ?
 
Last edited:

derez

Expert
Licensed User
Longtime User
Erel answered while I was writing... in general it will go something like this:
B4X:
...
GetView(panelbackground)
...

Sub GetView(V As View)
If V Is Label Then
    Dim l As Label
    l = V
    'do what you want with the label
Else
    If V Is Panel Then
        Dim P As Panel
        P = V
        For i = 0 To P.NumberOfViews -1
            'do something to the panel if you need to
            V = P.GetView(i)
        Next
    End If
End If
End Sub
 
Upvote 0

deltacode

Member
Licensed User
Longtime User
Cheers Erel, i did work this out after i had asked the question but i am very interested in the GetAllViewsRecursive method in the new version. Can you give any spoilers when this is expected to be released ?
 
Upvote 0
Top