iOS Question Cant get index of CLV with iTabstrip


Licensed User
Hi i need help cause i can't get the elements of the panel of CLV used with iTabstrip
This is the code i use

Dim index As Int : index=0
For Each colmenus As Map In menus

    'Create the page
    Dim categoria As Page
    categoria.Title = category

    Dim dishes As List = colmenus.Get("dishes")
    For Each coldishes As Map In dishes

        Dim price As Int = coldishes.Get("price")
        Dim name As String = coldishes.Get("name")
        Dim description As String = coldishes.Get("description")
        Dim dishLink As String = coldishes.Get("dishLink")
        Dim dishCode As String = coldishes.Get("dishCode")

        ' Add dish into the list
        clvMenu.Add(CreateListItem(dishCode, name, description, price, index), dishCode)
        index = index + 1
    'Add the page to the tab


Sub CreateListItem (DishCode As String, DishName As String, DishDescription As String, DishPrice As Double, Index As Int) As Panel
    Dim pnlItem As Panel
    pnlItem.Width = clvMenu.AsView.Width
    pnlItem.Height = 90dip
    pnlItem.Tag = Index & "=" & DishCode

    'Write the info
    lblName.Text = DishName
    lblName.Tag = DishCode
    lblDescription.Text = DishDescription
    lblPrice.Text = DishPrice
    lblPrice.Tag = Index
    lblItems.Tag = Index
    Return pnlItem
End Sub
The example is:

tsMenu with 3 tabs mean 3 pages
Page1 with 8 elements in the CLV
Page2 with 6 elements in the CLV
Page3 with 7 element in the CLV

Sub clvMenu_ItemClick (Index As Int, Value As Object)
    #If debug
    Log("CLV Index: " & Index)
    Log("CLV Value: " & Value)
    #end IF
End Sub
If i click on the Page1 i get CLV Index from 0 to 7
If i click on the Page2 i get CLV Index from 0 to 5
If i click on the PAge3 i get CLV Index from 0 to 6

Sub btnMas_Click

    'Get the index of the sender
    Dim index1 As Int
    Dim btn As Button = Sender
    index1 = btn.Tag
    Log("Index Boton: " & index1)

    Dim index As Int = clvMenu.GetItemFromView(Sender)
    Log("Index CLV: " & index)
    Dim pnl As Panel
    pnl = clvMenu.GetPanel(index)

End Sub
So if i try to get the text of the label when i click on the button on the Page3 all works right but when i try to get this from the Page1 or Page2 i get the error "Object was not initialized (UIView)"

Could somebody tell me what's wrong how can i get this work.

Thanks in advance.


Licensed User
Yes Erel,
Here is a sample with the problem is a mix with clv and itabstrip, with the Page3 works but with Page1 or Page2 there is the problem, i get the error "Object was not initialized (UIView)".

Thanks for your help.



Staff member
Licensed User
There are several mistakes here:
1. Use xCustomListView library instead of the old and deprecated CustomListView class.
2. You are using the same layout file for each of the tabs. The result is that clv1 points to the last added CLV. Create three layouts and give each one a different name.