containercontrol dynamic

Hello, comes an old example I wonder how you would use the dictionary, the problem I have is that in my tabs I add different containers and to send them to call or reference an object within them I need to create so many variables reference as containers I need to access and I do not know if with a dictionary I can avoid all this

This is old example

See my post in: https://forum.xojo.com/53506-webcontainer-control-issues

You avoid all of this by having your containers inherit from a common base class, or by having them implement one or more class interfaces.

By nature separate containers will have separate controls. So getting control values means deciding if an abstract interface can encapsulate the information you want from the containers, or if you need the actual control. If the latter, you can smooth over some of the pain by implementing a method in a base class which finds the control you want by name or some other form of identifier. That way you’re not select case casting to a dozen types just to get the value of a control.

I should add that if you have separate container types those containers should implement as much of their unique behavior internally as possible. Resist the urge to define behavior in the owning Window.

Let’s say you have an image editor with two tabbed containers. One changes image brightness, the other sharpens the image. The image might be stored as a property of the window, and the window might handle load/save. But the tabs should implement the code for their specific functions. If that code is in the window then the window has to cast types to access specific controls for their values, etc. If the behavior is in the container you can reference the controls directly.