When wanting to add another item to my ScrollView2D I use to use the following routine to determine where the next item should be inserted
NOW this routine worked fine as long as each entry only had ONE Panel.
Things have changed and I am adding items that have multiple panels in them and ALL the sub panels were be totaled up making the entries off.
So I added a value to my Tag field of the Sub Panels that I do not want to total (because the main panel is the size I want)
Now this is working just fine. But is there a BETTER way. Without storing information in the tag of panels I want to included?
What I am inserting looks something like this
So my first loop would add in the Main Panels height, then all the Sub Panel's heights making the display take up twice as much screen space then was used
WHAT I am doing works. But just seems messy.
BobVal
B4X:
'NOTE: PanelHeight is is the height of of the Main Panel shown below
Private sStandings_ScrollView As ScrollView2D
Dim TotalHeight As Int = 0
Dim MainPanel As Panel
MainPanel.Initialize("MainPanel")
MainPanel.Enabled = True
For Each v As View In sStandings_ScrollView.Panel.GetAllViewsRecursive
If v Is Panel Then
TotalHeight = TotalHeight + v.Height
End If
Next
sStandings_ScrollView.Panel.AddView(MainPanel, 0, TotalHeight, sStandings_ScrollView.Panel.Width, PanelHeight)
NOW this routine worked fine as long as each entry only had ONE Panel.
Things have changed and I am adding items that have multiple panels in them and ALL the sub panels were be totaled up making the entries off.
So I added a value to my Tag field of the Sub Panels that I do not want to total (because the main panel is the size I want)
B4X:
Private sStandings_ScrollView As ScrollView2D
Dim TotalHeight As Int = 0
Dim MainPanel As Panel
MainPanel.Initialize("MainPanel")
MainPanel.Enabled = True
For Each v As View In sStandings_ScrollView.Panel.GetAllViewsRecursive
If v Is Panel Then
Dim vTagCheck As String = v.Tag
If vTagCheck.Contains("~SkipMe~") Then Continue
TotalHeight = TotalHeight + v.Height
End If
Next
sStandings_ScrollView.Panel.AddView(MainPanel, 0, TotalHeight, sStandings_ScrollView.Panel.Width, PanelHeight)
Now this is working just fine. But is there a BETTER way. Without storing information in the tag of panels I want to included?
What I am inserting looks something like this
B4X:
MainPanel [ScrollView Panel as parent]
SubPanel1(has tag set to "~SkipMe~") [MainPanel as parent]
Label_101
Label_102
SubPanel2(has tag set to "~SkipMe~") [MainPanel as parent]
Label_201
Label_202
SubPanel3(has tag set to "~SkipMe~") [MainPanel as parent]
Label_301
Label_302
SubPanel4(has tag set to "~SkipMe~") [MainPanel as parent]
Label_401
Label_402
So my first loop would add in the Main Panels height, then all the Sub Panel's heights making the display take up twice as much screen space then was used
WHAT I am doing works. But just seems messy.
BobVal