Here is a better explanation of what I am trying to do.
Public Sub ResizeListView(aListView as ListView, aMinRows as Int, aExtraWidth as Int)
This sub will be used in other applications and unfortunately the Sub has no idea of how the ListView was created so I can't rely on AddSingleLine2() being used.
The purpose of the Sub is to resize the width of the Listview in order to display the text properly. It will also ensure that at least aMinRows are visible in the Listview. The Listview is being used as a popup menu and the text has to be readable and the Listview should only be wide enough to display the text and no wider.
I can use the code below to get the layout's Typeface and font size of the label(s) and size of the Bitmap:
Private locLabel1, locLabel2 As Label
Private locBM As Bitmap
locLabel1 = aListView.SingleLineLayout.Label
locLabel2 = aListView.TwoLinesLayout.SecondLabel
locBM = aListView.TwoLinesAndBitmap.ImageView
but I still need to know which layout was used when traversing through the items, so I can retrieve the appropriate Label1.text, Label2.Text or the Bitmap so I can determine the text lengths and resize the width of the ListView if necessary using code similar to that shown below:
for i=0 to aListView.Size-1
locWidth = CVS.MeasureStringWidth(aListView.GetItem(I), locLabel.TypeFace, locLabel.TextSize) + aExtraWidth
If locWidth > locMaxWidth Then
locMaxWidth = locWidth
End If
'How do I retrieve Label2 text? Or the bitmap?
Next
But I don't see any way to access the 2nd label info or the bitmap from items in the Listview.
Am I missing something or is Listview that limited?
TIA