Hello,
I have a sub that fill a custom view with a product list.
The _ItemClick event is handling perfectly his job , when we are clicking into the global item line, but :
that product list (code below) have 2 kind of added buttons which have to launch (with button_Click) 2 differents script than the global Itemclick :
- BtnVa for "ViewArticles" event
- and BtnVc for "ViewCat" event
How to send some parameters with that buttons initialisation or via an other way ?
Many thanks
I have a sub that fill a custom view with a product list.
The _ItemClick event is handling perfectly his job , when we are clicking into the global item line, but :
that product list (code below) have 2 kind of added buttons which have to launch (with button_Click) 2 differents script than the global Itemclick :
- BtnVa for "ViewArticles" event
- and BtnVc for "ViewCat" event
How to send some parameters with that buttons initialisation or via an other way ?
B4X:
Sub Product_List(Wit As Int, Hei As Int, Lbl0 As String, NbArt As Int, NbCatFils As Int, NumImg As String, BtnMenu As Button) As Panel
Dim p As Panel
p.Initialize("")
Dim ImgUrl As String
Dim links As Map
links.Initialize
If NumImg <> Null And NumImg <> "" Then
ImgUrl = Main.ConnectWebSite & Main.PathImg1 & NumImg & Main.ExtImg1
Dim ImgArticle As ImageView
ImgArticle.Initialize("ViewCat")
links.Put(ImgArticle, ImgUrl)
CallSubDelayed2(ImageDownloader, "Download", links)
ImgArticle.Width = 80dip
ImgArticle.Height = 60dip
ImgArticle.Gravity = Gravity.FILL
p.AddView(ImgArticle, 0, 0, 80dip, 60dip) 'Image
End If
Dim Lbl As Label
Lbl.Initialize("ViewCat")
Lbl.Text = Lbl0
Lbl.TextSize = 16
Lbl.Gravity = Gravity.LEFT + Gravity.CENTER_VERTICAL
p.AddView(Lbl, 85dip, 0, (Wit - 100) * 1dip, Hei) 'Libellé
Dim BtnVa As Button '<**************************
BtnVa.Initialize("ViewArticles")
If NbArt > 0 Then
BtnVa.Typeface = BtnMenu.Typeface
BtnVa.Text = Chr(0xF06E) & NbArt
BtnVa.TextSize = 16
BtnVa.Width = 45dip
BtnVa.Height = 45dip
BtnVa.Color = Colors.Transparent
BtnVa.TextColor = Colors.Black
If NbCatFils > 0 Then
p.AddView(BtnVa, Wit - 90dip, 0, 45dip, Hei - 2dip) 'Button View Articles
Else
p.AddView(BtnVa, Wit - 45dip, 0, 45dip, Hei - 2dip) 'Button View Articles
End If
End If
Dim BtnVc As Button '<***************************
BtnVc.Initialize("ViewCat")
If NbCatFils > 0 Then
BtnVc.Typeface = BtnMenu.Typeface
BtnVc.Text = Chr(0xF101)
BtnVc.TextSize = 18
BtnVc.Width = 45dip
BtnVc.Height = 45dip
BtnVc.Color = Colors.Transparent
BtnVc.TextColor = Colors.Black
p.AddView(BtnVc, Wit - 45dip, 0, 45dip, Hei - 2dip)
End If
Dim Line As Panel
Line.Initialize("")
Line.Height = 2dip
Line.Color = Colors.White
Line.Top = Hei - Line.Height
p.AddView(Line, 0, Line.Top, Wit, Line.Height) 'line
Return p
End Sub
Many thanks
Last edited: