i have two xcustomlistview in my project first clv called CustomListView1 and i use it as chat box
second clv called copymenu and i use it as menu
i am trying to place copymenu at the position of the clicked item of CustomListView1 in a previous thread Erel Suggested to do the following
B4X:
Sub CustomListView1_ItemClick (Index As Int, Value As Object)
copymenu.AsView.Top = CustomListView1.GetPanel(Index).Top - CustomListView1.sv.ScrollViewOffsetY + CustomListView1.GetBase.Top
If copymenu.AsView.Visible = True Then
copymenu.AsView.Visible = False
else If copymenu.AsView.Visible = False Then
copymenu.AsView.Visible = True
End If
End Sub
but the copy menu position is always showing on top not near the clicked item as it should be
i have logged copymenu Top property each time item clicked it return Zero
the clicked items list i added like that
B4X:
Sub CreateListItem(Text As String, Width As Int, Height As Int) As Panel
Dim p As Panel
p.Initialize("")
p.SetLayout(0, 0, Width, Height)
p.LoadLayout("cellitem")
lbltextbox.Text = Text
lbltextbox.Height = Height
lbltextbox.TextColor = 0xff000000
Return p
End Sub
I know that is a problem and I think that Erel needs to look at this.
To get the Top property we need: Return GetItem(Index).Panel
For the other properties we need: Return GetItem(Index).Panel.GetView(0)
It seems that there are two panels or B4XViews superimposed.
The first one holds the position, the dimesions are the same, and the second, a child of the first, holds the underlying views.