Container Control

I try to use Container Controls in a project. To test the use of Container Controls I designed one ContainerControl1 with one PushButton (PushButton1). In the IDE I put ContainerControl1 on a Window. No problems until now… Now, I try to change the caption of PushButton1 in the open event of the Window by:

dim cc as new ContainerControl1 cc.PushButton1.caption="test"

However, No change… What’s going wrong?

Once the ContainerControl is placed on the window, you just interact with it like any other control, so so need for the DIM statement (which is creating a new ContainerControl1 in memory not referring to the control on the window)…

self.ContainerControl1.PushButton1.caption = "test"

This solves the problem. And one more related question: I put Label1 in ContainerControl2. Now I want to put a variable number (a dynamic String Array) of labels based on Label1 of ContainerControl2 on a window during runtime. What’s the most efficient way to do that? Do you have some example code?

Hi Carlos, We’ve hosted 2 webinars on ContainerControls you may find helpful! The videos are posted on the Xojo You Tube channel.

Using Container Controls in a web app: http://www.youtube.com/watch?v=_tPBTYrha5E
Using ContainerControls in a desktop app: http://www.youtube.com/watch?v=wMhaX0ZCK5A

I think using a control set is the best way, but in all honesty, have not gotten around to using them myself… In the User Guide Book 2: User Interface" PDF if you go to section 2.16 Control Sets and Dynamic Controls that should help you a bit more…

Control sets are a very strange way of defining dynamic arrays of controls. However, it works… XOJO is good programming language to develop multi-platform applications, but the effort to learn the language is very high.

yeah… I just haven’t had a need for control sets and most of my GUI work is done through the use of HTMLViewers…