
Increase encapsulation and simplify complex window layouts.Create custom controls made up of other controls.Organize groups of controls into reusable interface components.The Container control is a special control that can contain any other control (including other Containers). /Java/Java Classes in RB/Java Function: Required plugins for this example: MBS Java Plugin You find this example project in your Plugins Download as a Xojo. See DesktopContainer for details on its events, methods and properties.

There are many great reasons to use Containers in your projects instead of creating windows with lots and lots of controls. Since a Container can be easily added to Windows, you can reuse these controls in multiple places without recreating the entire layout and any required code. The Container itself also makes it easy to encapsulate any specific methods or properties that are needed to tie all the controls together.Įven more generically, you can create your own custom controls using a Container. Xojo includes an example project that demonstrates how to create an OKCancelContainer whose buttons are properly position themselves on Windows/Linux and macOS (where OK/Cancel typically appears as Cancel/OK).

Such a Container can be easily reused in all your projects. Use a Container to simplify your Window layouts. Instead of adding dozens (or hundreds) of controls onto a Window, which makes it more complex and potentially adds lots of fragile dependencies, instead group your layout into multiple Containers, each having only the controls they need. A sample of the Right Now on eBay logo is shown below. Most Window layouts have multiple areas that are mostly independent from each other. With best in class technology, our goal is to create a marketplace of ideas in order to share. Consider a Mail app which typically has a section on the left with mailboxes, a section at the top with messages and a section at the bottom that shows the email message itself. This could easily be three Containers, one for each area of the user interface. You may then find that your window layout will instead have just a few Containers on it and is now much easier to work with while at the same time benefitting from better code organization and data separation.Ī Container that has been added to a layout cannot have its containing controls modified on the layout. You have to go back to the Container and change the controls using its Layout Editor. If you want to add additional controls to a Container without modifying the original Container, create a new Container and add the first Container to it.

A lot of other OOD: Classes info, but not how to subclass all base classes. I did do a Google search and a Google site search of the Forum, and a search of the Xojo documentation, but did NOT find an answer to this. There is no limit to the number of Containers you can embed in this manner. I am very new to Xojo, so I apologize if this has been asked/answered already. You cannot subclass Containers created with the Layout Editor. However, you can create a class with methods and properties that Containers can inherit.
