' MousePressed is triggered when the mouse button is pressed
Sub pnlItem_MousePressed (Eventdata As MouseEvent)
' Log($"Sub: pnlTabFixed_MousePressed in ${mName}"$)
Dim pnl As B4XView = Sender
Dim mClickedItem As Int
mClickedItem = CLV.GetItemFromView(pnl)
' To prevent doubleclicking
If Eventdata.SecondaryButtonPressed Then
Dim OldDestination As Int = mClickedItem
Dim pnlx As B4XView = CLV.GetPanel(mClickedItem).Parent
' Starting offset is the top of the clicked panel
Dim AbsOffset As Int = pnlx.Top
Dim offset As Int
Display_Row(mClickedItem)
Do While True
Wait For (pnl) pnlItem_MouseDragged (edata As MouseEvent)
'' The code below freezes, and freezes the display, after the first time it scrolls the clv
If offset < CLV.sv.ScrollViewOffsetY + 3*pnlx.Height Then
CLV.sv.ScrollViewOffsetY = Max(0, CLV.sv.ScrollViewOffsetY - 10dip)
Else If CLV.sv.ScrollViewOffsetY + CLV.sv.Height < offset + 3*pnlx.Height Then
CLV.sv.ScrollViewOffsetY = CLV.sv.ScrollViewOffsetY + 10dip
End If
'' The code above freezes, and freezes the display, after the first time it scrolls the clv
offset = AbsOffset + edata.y
Dim Destinationindex As Int = CLV.FindIndexFromOffset(offset)
If Destinationindex <> OldDestination Then
Display_Row(Destinationindex)
OldDestination = Destinationindex
End If
Loop
End If
End Sub
Sub Display_Row (Index As Int)
lblRowDisplay.Text = $"Mouse is over Row containing Item #${Index+1}"$
End Sub