'to group views and repond to all in a group, set their tags to a groupName
'example:
'Button1.Tag = "GrpA"
'and change the event handler to Private Sub GrpA_NormalClick(ViewName as String, View As B4XView)
'the parameter can be used in logic flow
'alternative grouping approach is to prefix the name of the views in a group with the group name and TWO underlines: GrpA__Button1
'I prefer this one, it leaves the tag property available for other things, and it makes it obvious what is intended
'However, the .tag method is useful when you are grouping the views in code instead of designer
'Both methods will work with the attached code block
'Example: Coded views - create and register a group of views
Dim cnt As Int
For i = 0 To 3
For j = 0 To 2
cnt = cnt + 1
If i = 3 And (j = 0 Or j = 2) Then Continue
Dim lbl As Label
lbl.Initialize("X_C")
Dim lblx As B4XView = lbl
lblx.SetColorAndBorder(xui.Color_Blue, 2dip, xui.Color_Blue, 25dip)
lblx.SetTextAlignment("CENTER", "CENTER")
lblx.Font = xui.CreateDefaultBoldFont(20)
lblx.TextColor = xui.Color_White
lblx.Text = IIf(cnt = 11, "0", cnt)
Root.AddView(lbl, 200dip + j * 52dip, 300dip + i * 52dip, 50dip, 50dip)
'Option 1: name method
dd.AddRuntimeView(lbl, "GrpB__btn" & cnt, Root, Null)
'Option 2: tag method
'lblx.Tag = "GrpB"
'dd.AddRuntimeView(lbl, "btn" & cnt, Root, Null)
Next
Next