B4J Question Moving Items Back and Forth Between xCustomListViews (with Double-Click)

B4XDev

Member
Licensed User
If you consider the attached project, I can single-click the "All Items" xCLV to move the clicked item to the "Active Items" xCLV, which remains sorted with each added item. (I basically clear the xCLV and redo it. Not sure if that's scalable performance-wise... We'll see when I have thousands of items... But, then I might need a UI modification...)

I'm trying to get items on the "Active Items" xCLV back to the "All Items" xCLV with a double-click, as the user can "Do Something" with the selected item.

I need the "All Items" xCLV to remain sorted (case insensitive) when items are added back.

Can anybody show me how to accomplish that double-click functionality?

Thank you!

2023.01.08 - New approach in this thread.
 

Attachments

  • xCLV-Switching.zip
    10.8 KB · Views: 73
Last edited:

DarkoT

Active Member
Licensed User
HI,
I will go in direction that I will use MAP variable which will always contains original xCL values.

B4X:
Private Items As Map
Items.Initialize
    
For Each item As String In allItems
        clv1.AddTextItem(item,item)
        Items.Put(item ,item)
Next

'longclick on selected items will store back
Private Sub clv2_ItemLongClick (Index As Int, Value As Object)
    ' remove item from map
    Items.Remove(Index)
    clv1.Clear
    
    For x = 0 To Items.size -1
        clv1.AddTextItem(Items.GetKeyAt(x), Items.GetValueAt(x))
    Next
    
End Sub

But - this routine is really slow because it's always clear and fullfill clv1 items... It's can be done with other routine...
 
Upvote 0

B4XDev

Member
Licensed User
But - this routine is really slow because it's always clear and fullfill clv1 items... It's can be done with other routine...

Apparently, there's no ItemLongClick event in B4J (?). I could not trigger this event on a Windows desktop.
 
Upvote 0

DarkoT

Active Member
Licensed User
Apparently, there's no ItemLongClick event in B4J (?). I could not trigger this event on a Windows desktop.
In B4J Desktop LongClick is RightMouseClick. If you need aditional events you can catch mouse events like doubleclick...
 
Upvote 0

B4XDev

Member
Licensed User
I've given up on this particular approach and have built a B4XTable solution that seems to work just fine. I will post it here when it is done and if I remember. ?
 
Upvote 0
Top