So I was searching for how to have a checkbox in a listbox and came across this thread: where Brock Nash posted an example of how to embed a checkbox in a listbox. So I'm wondering the best way to create an unknown number of embedded checkboxes using this technique so I can populate every row. What I'm stumped about is how to create all the necessary objects for n number of rows on the fly and increment the naming to match the rows.
Creating one is easy:
Dim cccb As CCCheckBox = new CCCheckBox
cccb.EmbedWithin(session.CurrentPage, 0, 0, cccb.Width, cccb.Height)
Me.cellPrependControl(cccb, 1, 0)
But how does one do something like this so that Xojo accepts the object names on the fly?:
For idx = 0 To ListBox1.RowCount -1 // create NEWOBJECTNAME from a base name incremented with the idx is the part I don't know how to do. i.e. cccb0, cccb1, cccb2, etc. Dim NEWOBJECTNAME As CCCheckBox = new CCCheckBox NEWOBJECTNAME.EmbedWithin(session.CurrentPage, 0, 0, NEWOBJECTNAME.Width, NEWOBJECTNAME.Height) Me.cellPrependControl(NEWOBJECTNAME, idx, 0) Next
I am probably missing something obvious or approaching the problem of populating an unknown number of objects wrong so please help me out here if you know how to fill my knowledge gap.