Wish Please add to XCustomListView

Peter Simpson

Expert
Licensed User
Longtime User
Hello Erel,
I've been using the XCustomListView for quite some time now, I personally don't like using the standard click event for selecting rows, actually I've added a LongClick event as it's to easy for my clients to accidentally tap on the screen when using their bespoke apps.

Every time you update the class (which is currently on v1.64) I download and add the class to my shared folder. I've added the LongClick event to the class and I have to keep updating it whenever I update the class. I presume that other developers and their clients would find the LongClick event useful like my clients do when selecting a row/panel etc.

Would you consider adding the following LOC to the XCustomListView class as standard, thus other developers could either use Click or LongClick event.

I've just added the extra code underneath the Click subs that are already in the class for neatness.

B4X:
#Event: ItemLongClick (Index As Int, Value As Object)

'-------------------------------------------------------------

'In the main class code
Private Sub PanelLongClickHandler(SenderPanel As B4XView)
    Dim clr As Int = GetRawListItem(SenderPanel.Tag).Color
    SenderPanel.SetColorAnimated(50, clr, PressedColor)
    If xui.SubExists(CallBack, EventName & "_ItemLongClick", 2) Then
        CallSub3(CallBack, EventName & "_ItemLongClick", SenderPanel.Tag, GetRawListItem(SenderPanel.Tag).Value)
    End If
    Sleep(200)
    SenderPanel.SetColorAnimated(200, PressedColor, clr)
End Sub

#If B4A
Private Sub Panel_LongClick
    PanelLongClickHandler(Sender)
End Sub

#else If B4i.....
Private Sub Panel_LongClick
    PanelLongClickHandler(Sender)
End Sub

Private Sub Panel_MouseLongClicked (EventData As MouseEvent)
    PanelLongClickHandler(Sender)
End Sub

Thank you...
 

Peter Simpson

Expert
Licensed User
Longtime User
You NEED to learn to read my post correctly before responding to them @LucaMs

I'm not asking a question, I'm requesting a feature which I've been using since V1.52 I do believe. It might be the same thing (which I've not seen) but it's a wish on my behalf. I'm not going to look in question for a wish or a feature...
 

LucaMs

Expert
Licensed User
Longtime User
You NEED to learn to read my post correctly before responding to them @LucaMs

I'm not asking a question, I'm requesting a feature which I've been using since V1.52 I do believe. It might be the same thing (which I've not seen) but it's a wish on my behalf...
Take it easy, Peter. Maybe you need to understand my post; it just shows that the same request had already be done (recently and although in the wrong place).
Just to say that other people would like it.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
The problem with the code you made is that it is not cross platform. It will not work in B4J. It is possible to add non-cross platform features to cross platform classes however there should be a very good reason for it.

I don't think that this is the case here. You can add the events in your code without modifying the class:
B4X:
Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("1")
   For i = 1 To 100
       Dim p As Panel
       p.Initialize("p")
       p.SetLayout(0, 0, clv1.AsView.Width, 50dip)
       p.LoadLayout("cellitem")
       clv1.Add(p, "")
   Next
End Sub

Sub p_Click
   Dim i As Int = clv1.GetItemFromView(Sender)
   Log("click: " & i)
End Sub

Sub p_LongClick
   Dim i As Int = clv1.GetItemFromView(Sender)
   Log("long click: " & i)
End Sub
 
D

Deleted member 103

Guest
Hello Erel,
I've been using the XCustomListView for quite some time now, I personally don't like using the standard click event for selecting rows, actually I've added a LongClick event as it's to easy for my clients to accidentally tap on the screen when using their bespoke apps.

Every time you update the class (which is currently on v1.64) I download and add the class to my shared folder. I've added the LongClick event to the class and I have to keep updating it whenever I update the class. I presume that other developers and their clients would find the LongClick event useful like my clients do when selecting a row/panel etc.

Would you consider adding the following LOC to the XCustomListView class as standard, thus other developers could either use Click or LongClick event.

I've just added the extra code underneath the Click subs that are already in the class for neatness.

B4X:
#Event: ItemLongClick (Index As Int, Value As Object)

'-------------------------------------------------------------

'In the main class code
Private Sub PanelLongClickHandler(SenderPanel As B4XView)
    Dim clr As Int = GetRawListItem(SenderPanel.Tag).Color
    SenderPanel.SetColorAnimated(50, clr, PressedColor)
    If xui.SubExists(CallBack, EventName & "_ItemLongClick", 2) Then
        CallSub3(CallBack, EventName & "_ItemLongClick", SenderPanel.Tag, GetRawListItem(SenderPanel.Tag).Value)
    End If
    Sleep(200)
    SenderPanel.SetColorAnimated(200, PressedColor, clr)
End Sub

#If B4A
Private Sub Panel_LongClick
    PanelLongClickHandler(Sender)
End Sub

#else If B4i.....
Private Sub Panel_LongClick
    PanelLongClickHandler(Sender)
End Sub

Private Sub Panel_MouseLongClicked (EventData As MouseEvent)
    PanelLongClickHandler(Sender)
End Sub

Thank you...
+1
 

Peter Simpson

Expert
Licensed User
Longtime User
Good morning Erel
Hmm that's interesting and didn't XCross my mind ;)

I personally don't really use B4J for any larger projects for any of my client, sadly I only use B4J for smaller personal apps usually for testing purposes 95% of the time. I do want to create more windows solution for clients using B4J, but I'm personally so used to creating Windows solution using VS that it's just 2nd nature to me. I did try it once for a client, but then I scrapped that project after a couple of days and went straight to VS, I then created the solution in just a few hours, It's just what I'm used to.

So even though your code above work's perfectly fine and I've taken note of it, I'll be sticking to the modified class as it just means that I don't have to add the code to clients bespoke apps, and as they say, 'If it ent broke...' (for now).

Thank you for your fast response to my 'Wish' @Erel, have a nice day...
 
Last edited:
Top