Hi to all
I have a CustomListView. On each line (row) of it I have put a small panel. "col". The CustomListView shows some items and the small Panel "col" on each line represents the color of each item. Each panel col is initialized with an event and has the Tag property set to the CustomListView row. The question is: is it possible to get the CustomListView row only clicking the small Panel "col" (on each line of the List), firing its event? Of course I can select the row in the ListView. but the idea is to by-pass selecting the ListView row, only clicking the Panel in its rows. This happens if I have no event in the Col, because the Click on the col panel is passed to its parent (i guess). But if the col panel has its own event, I don't see the possibility to get the ListView row. The attached code explains my question, I hope.
I have a CustomListView. On each line (row) of it I have put a small panel. "col". The CustomListView shows some items and the small Panel "col" on each line represents the color of each item. Each panel col is initialized with an event and has the Tag property set to the CustomListView row. The question is: is it possible to get the CustomListView row only clicking the small Panel "col" (on each line of the List), firing its event? Of course I can select the row in the ListView. but the idea is to by-pass selecting the ListView row, only clicking the Panel in its rows. This happens if I have no event in the Col, because the Click on the col panel is passed to its parent (i guess). But if the col panel has its own event, I don't see the possibility to get the ListView row. The attached code explains my question, I hope.
B4X:
#Region Shared Files
#CustomBuildAction: folders ready, %WINDIR%\System32\Robocopy.exe,"..\..\Shared Files" "..\Files"
'Ctrl + click to sync files: ide://run?file=%WINDIR%\System32\Robocopy.exe&args=..\..\Shared+Files&args=..\Files&FilesSync=True
#End Region
'Ctrl + click to export as zip: ide://run?File=%B4X%\Zipper.jar&Args=Project.zip
Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Private CustomListView1 As CustomListView
End Sub
Public Sub Initialize
' B4XPages.GetManager.LogEvents = True
End Sub
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
End Sub
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
Private Sub Button1_Click
'xui.MsgboxAsync("Hello world!", "B4X")
For i = 0 To 10
Dim p As B4XView = xui.CreatePanel("")
p.SetLayoutAnimated(0, 0, 0, 100, 50dip)
Dim col As Panel
col.Initialize("col") ' if this event is defined, the ListView_ItemClick is not fired, if not defined it is
col.Color=Colors.Black
col.Tag=i
p.AddView(col,CustomListView1.AsView.Width-60dip, 0dip, 50dip, 50dip)
CustomListView1.Add(p, i)
Next
End Sub
Sub col_click
Log("Col fired") ' the question is: can we get the ListView row here
End Sub
Sub CustomListView1_ItemClick (Index As Int, Value As Object)
Log(Value)
End Sub