Hi, I am trying to create a Point of Sales application. I am adding an Expandable xCustomListView in my Product Cart area where user's desired product will be showed. When user click on expand button, there will be three button. One is increase product, another one is decrease product and other is remove product. I am successfully manage to create the layout with sample products and quantity but what I am unable to work is with functionality ... means clicking on button will increase quantity label up or down or remove the entire panel.
Following is my code snipes .... When creating Layout ...
Now I want to create the functionality for Add / Less quantity or Delete ... I had tried it as follows but unable to do it as it shows error ...
Thank you for your support
Following is my code snipes .... When creating Layout ...
B4X:
Sub CreateItem(clr As Int, LineNo As Int, Title As String, ExpandedHeight As Int) As B4XView
Dim p As B4XView = xui.CreatePanel("")
p.SetLayoutAnimated(0, 0, 0, lstProdCart.AsView.Width, ExpandedHeight)
p.LoadLayout("CartList")
p.SetLayoutAnimated(0, 0, 0, p.Width, p.GetView(0).Height) 'resize it to the collapsed height
' Cart Width Is 30%, So All Width Based On It ...
pnlProdList.Width = 30%x
pnlProdDet.Width = 30%x
' Can't Manage To Set Width Of The Panels. So Reduce It To 30% Calculation
lblRowNo.Width = 4%x
lblProdName.Width = 12%x
lblQnty.Width = 5%x
lblWght.Width = 4%x
lblDropArrow.Width = 5%x
lblLess.Left = 30dip
lblAdd.Left = lblLess.Width + 30dip
lblDelete.Left = lblLess.Width + lblAdd.Width + 30dip
lblRowNo.Left = 0
lblProdName.Left = lblRowNo.Width
lblQnty.Left = lblRowNo.Width+lblProdName.Width
lblWght.Left = lblRowNo.Width+lblProdName.Width+lblQnty.Width
lblDropArrow.Left = lblRowNo.Width+lblProdName.Width+lblQnty.Width+lblWght.Width
lblRowNo.Text = LineNo
lblProdName.Text = Title
lblQnty.Text = LineNo
lblWght.Text = "Pcs"
pnlProdList.Color = clr
pnlProdDet.Color = ShadeColor(clr)
Return p
End Sub
Now I want to create the functionality for Add / Less quantity or Delete ... I had tried it as follows but unable to do it as it shows error ...
B4X:
Sub lblAdd_Click
' Dim LabelValue As Int = lblQnty.Text
' LabelValue = LabelValue + 1
' lblQnty.Text = LabelValue
Dim index As Int = lstProdCart.GetItemFromView(Sender)
Log($"Index Of Item ${index}"$)
Dim pnl As B4XView = lstProdCart.GetPanel(index)
Dim intProdQnty As B4XView = pnl.GetView(2) ' Third label is Quantity
Log(intProdQnty) ' Error shows ....
' Code to increase the Label text, but how to ...
End Sub
Thank you for your support