I just added my first usage of CLV.
It functions as expected initially, after an item is selected, and the _Click is called, I clear/disable/sendtoback as shown below, but the CLV shortly reappears with a green highlight on the selected item. I tried using a CallSubDelayed to delay the clear/disable/sendtoback, but it didn't help. Do I need to patch in a wait?
It is under the other controls on the main view. If I poke at it, it flashes and eventually disappears. If instead of using a quick press to select an item, I use a long press, the menu still reappears, but without the green highlight on the pressed item.
Seems like there are queued messages/actions that it receives after my CallSubDelayed actions.
It functions as expected initially, after an item is selected, and the _Click is called, I clear/disable/sendtoback as shown below, but the CLV shortly reappears with a green highlight on the selected item. I tried using a CallSubDelayed to delay the clear/disable/sendtoback, but it didn't help. Do I need to patch in a wait?
It is under the other controls on the main view. If I poke at it, it flashes and eventually disappears. If instead of using a quick press to select an item, I use a long press, the menu still reappears, but without the green highlight on the pressed item.
Seems like there are queued messages/actions that it receives after my CallSubDelayed actions.
B4X:
Sub Globals
Dim clv1 As CustomListView ' for menus
Sub Activity_Create(FirstTime As Boolean)
clv1.Initialize(Me,"clv1")
Activity.AddView(clv1.AsView, 25%x, 25%y, 50%x, 50%y)
clv1Hide
Sub clv1Hide
clv1.AsView.Color = 0
clv1.AsView.Enabled = False
clv1.AsView.SendToBack
clv1.Clear
End Sub
Sub mnuBtn_Click ' GUI button handler
clv1.Clear
clv1.AddTextItem("Do A",0)
clv1.AddTextItem("Do B",1)
clv1.AddTextItem("Do C",2)
clv1.AddTextItem("Do D",3)
clv1.AsView.Color = Colors.Gray
clv1.AsView.Enabled = True
clv1.AsView.BringToFront
End Sub
Sub clv1_ItemClick (Index As Int, Value As Object)
' Try doing action delayed
CallSubDelayed2(Me,"MenuItemAction",Index)
End Sub
Sub MenuItemAction(Index As Int)
Select Index
Case 0
DoA
Case 1
DoB
Case 2
DoC
Case 3
DoD
End Select
' Try delaying the clear/disable/sendtoback
CallSubDelayed(Me,"clv1Hide")
End Sub
Last edited: