Android Question CLVSWIPE+CLV_HORIZONTAL

Uniko Sistemi srl

Active Member
Licensed User
Hi everyone!
I'm trying the project with CLVswipe and I introduced a horizontal CLV which I have some problems with.
The problem is that if I scroll horizontally with my finger slowly the list scrolls, if I do it quickly it doesn't. Am I doing something wrong?
Thank you
I attach the modified example project
 

Attachments

  • CLVSwipe_horiz.zip
    15.8 KB · Views: 31

MarcoRome

Expert
Licensed User
Longtime User
1) When you export an example to B4XPages you need to hold down the Ctrl key + click on the following link (which you will find inside the module).
Otherwise it becomes a mess

1704300409603.png


2) Look at this example. There are no delays or anything everything works fine

 
Upvote 0

Uniko Sistemi srl

Active Member
Licensed User
1) When you export an example to B4XPages you need to hold down the Ctrl key + click on the following link (which you will find inside the module).
Otherwise it becomes a mess

View attachment 149247

2) Look at this example. There are no delays or anything everything works fine
Sorry, I'm attaching the project again.
So is this problem happening to me only when scrolling horizontally?
I do not understand

Thank you
 

Attachments

  • Project.zip
    19.3 KB · Views: 27
Upvote 0

MarcoRome

Expert
Licensed User
Longtime User
Sorry, I'm attaching the project again.
So is this problem happening to me only when scrolling horizontally?
I do not understand

Thank you

From your example the result I get is the following ( ?? )

1704301015941.png


This code is incorrect. What would you like ?

B4X:
Sub CreateItems
    
    
    For i = 1 To 1
        addRow1(i)
        
    Next
    
    
    
End Sub
Private Sub addRow1(rowIndex As Int)
    
    Dim pnl As B4XView = xui.CreatePanel("")
    pnl.SetColorAndBorder(xui.Color_Transparent, 1dip, xui.Color_Black, 5dip)
    pnl.SetLayoutAnimated(0, 0, 0, 500dip, 120dip)
    pnl.LoadLayout("2")            'has horizontal clv anchored all sides
    
    
    clvItem.Add(newItem(rowIndex, 2, "Item2"), 0)
    clvItem.Add(newItem(rowIndex, 3, "Item3"), 0)
    clvItem.Add(newItem(rowIndex, 4, "Item4"), 0)
    clvItem.Add(newItem(rowIndex, 5, "Item5"), 0)
    clvItem.Add(newItem(rowIndex, 6, "Item6"), 0)
    clvItem.Add(newItem(rowIndex, 7, "Item7"), 0)
    clvItem.Add(newItem(rowIndex, 8, "Item8"), 0)

    
    CustomListView1.Add(pnl, 1)
End Sub
Private Sub newItem(rowIndex As Int, colIndex As Int, s As String) As B4XView
    Dim btn As Button
    btn.Initialize("btn")
    Dim btnx As B4XView = btn
    btnx.SetTextAlignment("CENTER", "CENTER")
    btnx.Text = s
    btnx.Tag = Array As Int(rowIndex, colIndex)
    btnx.Color = Colors.Black
    btnx.SetColorAndBorder(xui.Color_black, 1dip, xui.Color_Black, 5dip)
    Dim pnl As B4XView = xui.CreatePanel("")
    pnl = xui.CreatePanel("")
    'pnl.SetColorAndBorder(xui.Color_Transparent, 1dip, xui.Color_Black, 5dip)
    pnl.SetLayoutAnimated(0, 0, 0,250dip, 120dip)
    pnl.AddView(btnx, 0, 0, 250dip, 120dip)
    Return pnl
End Sub

if you look at the (working) example code you have

B4X:
Sub CreateItems
    Dim cs As CSBuilder
    For i = 1 To 100
        cs.Initialize.Color(Rnd(0xff000000, -1))
        If i Mod 3 = 0 Then
            cs.Append($"Important item ${i} ..."$).PopAll
            CustomListView1.AddTextItem(cs, Swipe.CreateItemValue("", Array("Delete", "Do Something Else")))
        Else If i Mod 3 = 1 Then
            cs.Append($"Very important item ${i} ..."$).PopAll
            CustomListView1.AddTextItem(cs, Swipe.CreateItemValue("", Array("Action 1", "Action 2", "Action 3")))
        Else
            cs.Append($"Nothing to see here ${i}"$).PopAll
            CustomListView1.AddTextItem(cs, Null)
        End If
    Next
End Sub
 
Upvote 0

Uniko Sistemi srl

Active Member
Licensed User
From your example the result I get is the following ( ?? )

View attachment 149249

This code is incorrect. What would you like ?

B4X:
Sub CreateItems
   
   
    For i = 1 To 1
        addRow1(i)
       
    Next
   
   
   
End Sub
Private Sub addRow1(rowIndex As Int)
   
    Dim pnl As B4XView = xui.CreatePanel("")
    pnl.SetColorAndBorder(xui.Color_Transparent, 1dip, xui.Color_Black, 5dip)
    pnl.SetLayoutAnimated(0, 0, 0, 500dip, 120dip)
    pnl.LoadLayout("2")            'has horizontal clv anchored all sides
   
   
    clvItem.Add(newItem(rowIndex, 2, "Item2"), 0)
    clvItem.Add(newItem(rowIndex, 3, "Item3"), 0)
    clvItem.Add(newItem(rowIndex, 4, "Item4"), 0)
    clvItem.Add(newItem(rowIndex, 5, "Item5"), 0)
    clvItem.Add(newItem(rowIndex, 6, "Item6"), 0)
    clvItem.Add(newItem(rowIndex, 7, "Item7"), 0)
    clvItem.Add(newItem(rowIndex, 8, "Item8"), 0)

   
    CustomListView1.Add(pnl, 1)
End Sub
Private Sub newItem(rowIndex As Int, colIndex As Int, s As String) As B4XView
    Dim btn As Button
    btn.Initialize("btn")
    Dim btnx As B4XView = btn
    btnx.SetTextAlignment("CENTER", "CENTER")
    btnx.Text = s
    btnx.Tag = Array As Int(rowIndex, colIndex)
    btnx.Color = Colors.Black
    btnx.SetColorAndBorder(xui.Color_black, 1dip, xui.Color_Black, 5dip)
    Dim pnl As B4XView = xui.CreatePanel("")
    pnl = xui.CreatePanel("")
    'pnl.SetColorAndBorder(xui.Color_Transparent, 1dip, xui.Color_Black, 5dip)
    pnl.SetLayoutAnimated(0, 0, 0,250dip, 120dip)
    pnl.AddView(btnx, 0, 0, 250dip, 120dip)
    Return pnl
End Sub

if you look at the (working) example code you have

B4X:
Sub CreateItems
    Dim cs As CSBuilder
    For i = 1 To 100
        cs.Initialize.Color(Rnd(0xff000000, -1))
        If i Mod 3 = 0 Then
            cs.Append($"Important item ${i} ..."$).PopAll
            CustomListView1.AddTextItem(cs, Swipe.CreateItemValue("", Array("Delete", "Do Something Else")))
        Else If i Mod 3 = 1 Then
            cs.Append($"Very important item ${i} ..."$).PopAll
            CustomListView1.AddTextItem(cs, Swipe.CreateItemValue("", Array("Action 1", "Action 2", "Action 3")))
        Else
            cs.Append($"Nothing to see here ${i}"$).PopAll
            CustomListView1.AddTextItem(cs, Null)
        End If
    Next
End Sub
Hello and thanks.
my goal was to show what creating a horizontal clv inside a vertical main clv looked like. The attached example does this, perhaps not in the correct way (maybe I'm doing that one wrong)
do you have any suggestions?
Thank you
The original example that works, however, shows a simple CLVswipe that vertically, instead of vertical items, I would like to have many CLVs that scroll horizontally with as many items

thanks for your patience
 
Upvote 0

Uniko Sistemi srl

Active Member
Licensed User
I attach an example with the original code, does it happen to you too that the horizontal scrolling is not optimal? to scroll I have to swipe slowly, but as soon as I speed up it doesn't scroll. Thank you
 

Attachments

  • Project_1.zip
    19.3 KB · Views: 28
Upvote 0

MarcoRome

Expert
Licensed User
Longtime User
Allego un esempio con il codice originale, capita anche a te che lo scorrimento orizzontale non sia ottimale? per scorrere devo scorrere lentamente, ma appena accelero non scorre. Grazie

I see it as in the example given. Smooth without slowdowns
 
Upvote 0
Top