How to work with Dynamic Controls in an "array"

[quote=79400:@William Koperwhats]So what if you wanted to add additional text fields to your “Set”? Or change the .BackColor on all of them? Or simply determine how many “myTextFields” you already have created. My point is that there is no way, other than iterating over every single control on your Window, determining the control’s name and/or provenance, and adding things up manually, to do these things.

The concept of object “Collections” has been around a long time, complete with Keys, automatically updated indices, .Count, .Append, .Insert, methods, etc. My point is that it’s time to apply these practices in Xojo to Controls Sets (and Menus) consistently. Right now it’s a mess.[/quote]
Honestly, you should use ContainerControls and make a feedback case. Referencing would be easy then?!?

[quote=79386:@William Koperwhats]If that’s the case then Xojo is a lot further behind on this than I give them credit for. I’ve been able to efficiently (and logically) work with collections of controls (or objects) in VB for over 15 years!
[/quote]
Oh it’s not “we can’t” - we just don’t use them in the IDE because there’s no advantage to them
Doing things based on the name of the control is just not the best way to do things
We tend to use lots and lots of little subclasses and each subclass does its thing in the way the subclass is crafted - and not by the name
And we use lots of interfaces so we can do things like assign “text” or “color” to anything that is one of a handful of interface types regardless of whether its in a control set or not

Just caught Paul (Lefebvre)'s webinar on dynamic controls. Very timely. One thing that he didn’t mention, and that took me a while of pulling my hair to figure out, is that when a new instance of a control is created (using Dim ctrl as New myControl), even though Paul mentions that the control is created in the same location as the original “master” copy, this isn’t necessarily correct. What I found is that the new control will be created at the original location (as defined in the IDE) of the master control, not it’s dynamic location when the application is running.

For example, if a “master” button (Control Set index = 0) is placed on the window and then locked to the right and bottom sides, when the widow is resized, any new instances of the original will be created at the original Left and Top positions, not the new one. Because many of my dynamic controls are layered in various canvasses, they were getting created “off canvas” in locations that I couldn’t see them.

The moral of the story is that, unlike the code in the example project, it is good practice for the user to set both the Left and Top properties of an new control.