I want to stack a bunch of WebCheckBoxes in a column.
I created an subclass of WebContainer called CheckBoxListView.
In the IDE I put a single instance of a WebCheckBox in the CheckBoxListView.
Now as I add more rows i just create another instance of the WebCheckBox and embed it within the CheckBoxListView instance?
I suppose I have to ‘hook up’ the WebCheckBox events when I’m embedding them as well.
I’m here because I’m not sure this is the way to go… I remember something about control arrays and starting with one instance…
but then I’m not sure it works for web.
Suggestions?
This is the way to go in web apps.
Using EmbedWithin you can embed containers at runtime.
It’s up to you to keep track of the embedded containers.
P.S.
You can embed only containers not single webcontrols.
This works only in Desktop.
Ok so I’m on the right track with embed within and addhandler etc.
When should I call removehandler?
I have a removeall method to clear the list, but what about the close event of the parent page or control?
When the parent page or view is closed all of it’s contents it’s closed.
If you close a container you don’t need to remove an event handler added to him.
If you Close() a container please remember to Nil the variable holding the instance of the closed container.
Each instance of a webcontainer created at runtime it’s an independent entity.
You can try and test them starting with the dynamic container example program installed with Xojo.
Regards.