I created a custom control (a container control with a textfield, canvas and scrollbar)
and needed two on a window… but I cannot make a control array??? What?
so I need to do
xyz1.dosomething()
xyz2.dosomething()
instead of
for i=0 to 1
xyz(i).dosomething
next i
while the above seems trivial, the completed app needs to manipulate those two instances dozens of ways under as many circumstances
probably going to have to do this
function getControl(index) as myContainer
select case index
case 0
return xyz1
case 1
return xyz2
end function
You can work around it. ContainerControls don’t need to be in an existing control-array to create instances on the fly. Just make an array property - you’ll need to store references to the containers you embed anyway. You’d be able to loop through the array to DoSomething.
for i as Integer = 0 to aroContainerArrayProperty.Ubound
aroContainerArrayProperty(i).DoSomething
next
I would argue that it makes more sense for you to have your own array for ContainerControls anyway. They are not traditional controls and are really special windows.
To make ContainerControl Arrays: In your ContainerControl make a Property called “Index” if that doesn’t exist. Select this ContainerControl and choose “Inspector Behavior…”. Check the “Index” property and close it. Now when you go to the second page of “Inspector” in the IDE, you’re able to make it a member of a Control Set and create more instances.
However, you can’t refer in your code to “Index”. It will give you a wrong number. Instead, use an extra Property, something like “id” or so and use that to detect which item is selected.