Android Question Setting up a B4APlusMinus control programmatically

Brian Dean

Well-Known Member
Licensed User
Longtime User
I am loading a small Layout containing only a label and a B4XPlusMinus to a panel and then adding the panel to a scrollview - several times. I want to set up each label/B4XPlusMinu pair with values from a list of data. This is what I would like to write ...

B4X:
pnl.LoadLayout("measurementItem")
Dim lbl As Label = pnl.GetView(0)
lbl.Text = m.description
Dim bpm As B4XPlusMinus = pnl.GetView(1)
bpm.Increment = m.increment
'        etc  etc . . .
bpm.Tag = i

Setting up the label works, but setting up the B4XPlusMinus doesn't. I understand why (B4XPlusMinus is not a View) but I cannot find a way to get around that problem. Note also that I want to set a Tag (or something equivalent) so that when a B4XPlusMinus value is updated I can also update the list of stored values using the _ValueChanged handler.

Generally I would set up the panel programatically (I rarely use Layouts) but this time I am trying to help out another forum member. How can I do this with a Layout?
 
Top