That's a good approach, Mike.
Keep things encapsulated, that won't work without each other.
First of all, we should clarify to Alisaif: There is no simultaneous init of all controls of a form, so ThisForm.Tree1.ImageList = ThisForm.TreeImages only works in Tree1.Init(), if the TreeImages control was inited before.
If you go for riscs, you can set taborder, actually I'm not sure, I think it's rather the zorder on the form.
...testing...
Yes, controls are inited in zorder, so what you "Send to Back" in the Format menu of the form or class editor, is inited before what is in front of it, because that order is determining the record order in the scx or vcx, I assume.
You see, "I assume", even though I tested, this is just a test, this observation of a test is no proof. Mike only relies on what's working in any case, the outer container is the last thing initing, that's valid for the form, or in case you define a container class, the container is inited after all controls in it (and before the form, on which you put it).
Anyway, if you define such compound controls depnding on each other being present, a container is a good base class for that to have a level where the objects exist, that depend on each other, and container.init() then is the event to put any initialisation acting on two or more inner controls. There is another base class called "control", that is meant for designing such compound controls, not only in case of combining activex controls.The control class has it's pros and cons and in the end the container is simpler to use, unless you want to be real nerdy.
Ideally you don't use the native container class, but your own container classs with borderwidth set to 0 and backstyle transparent, so such containers of compound controls integrate seamless onto forms.
If you put Tree1 and TreeImages into your container, the Container.Init() code needs to be:
Code:
This.Tree1.ImageList = This.TreeImages
Not Thisform, of course. Don't forget to adjust that.
Bye, Olaf.