Unknow (to me) Controls

The title can also be “How do I use” some Controls…

To be clear, for me, there is two kinds of Controls:
The ones that goes directly to a Window (TextField/TextArea/Canvas/ListBox)
The ones that goes to the Navigation Pane.

I will take the DesktopContainer Control as an example. The documentation description says:

Description

Used to embed a group of controls in a Window or in another control.

Properties

So, I fired Xojo 2025r1.1, creates a New Project, search the DesktopContainer Control and double-click in it.

IT GOES TO THE NAVIGATION PANE.

That said, what do I do with it ?
What is its purpose (how do I “embed a group of Controls…” and… WHY ?)

And this is so BASIC that nobody explain its potential uses. If you do not know what to do with it / you do not use it. (Of course !).

I welcome every explanation / link to tutorial (except videos).

Right-Clik in the Navigation pane gives:

Closer view:

These are not prefixed Desktop…

Correct. or you add it by clicking on the PLUS and then on “Container”.


Then you select it in the Navigator and add stuff to it like you do it in a Window-Object.
Next you select a Window in the Navigator and then you Drag&Drop your Container from the Navigator into this Window.


You can use it for example, to build your own controls.
Here’s a container with a listbox and +/- buttons below it.


And here’s a window in which i dropped this container 4x.


And i’m glad it’s like this. :slight_smile:

1 Like

Let’s stick with the container as an example: I use it, for example, to divide complex windows into less complex areas. Or to make it easier to edit pages in PagePanels by building each page in a container.

The integration of containers in Xojo has made my life a lot easier. I use them in a thousand different situations. They’re extremely flexible.

2 Likes

For any class or control in the navigator, you should be able to right-click and see an item called Superclass. If you select this, it will show the class’ supers in reverse order all the way up and including the internal Xojo classes which are disabled since you can’t see their internals. This is a great way to find out if the super is prefixed or not.

1 Like

Thank you.

But I still do not understand what use I can have for it.

I can use a GroupBox (and it have a title property) to set together a group of related Controls (for example).

How is this a problem? :slight_smile:

It is not. I only want to understand.

Or maybe I can forget it ? é7 years without (1998-2025), I can continue that way.

1 Like

For example, I have a project in which I’m working with multiple PagePanels and TabPanels in one of the windows.
Editing the contents of these panels in that single window would be slow and cumbersome. Therefore, I have the panel contents in containers that I can edit quickly without being slowed down by the other elements or accidentally changing them.

Then, in the same project, I have a search control that I created in a small container from a SearchField subclass and a few other elements. I use this search control in various windows.
Bildschirmfoto-1

Thank you.

I will re-read your explanations later to be sure I understand correctly.

Open the example Platforms → DeskTop → Container

Shows some good examples of using containers

1 Like

Containers make it easy to control layouts. I wrote an app that uses three containers with two splitters. Trying to adjust the layouts of all the controls inside the containers, without using containers would be a freaking nightmare. The containers are outlined in red below


For example, in one of my apps there is an option to automatically tag image files depending on their pathname. The controls comprising a rule are enclosed in a container:

The user can add any number of rules, and these can also be reordered or deleted. By using containers this was really easy to implement:

Containers serve two purposes:

  1. Reusability, so you can build one control from many controls, and reuse it as needed.
  2. Compartmentalization, to avoid spaghetti code.

Below is a screenshot of my app, which demonstrates both of these uses. The colored rectangles are each a separate container nested inside each other. This allows me to develop a separate container for each of the sections on the left, so they all exist fully independent of each other. Inside that, I’ve used more containers as the needs of that section arise. When it comes to reusability, the 4 status bars at the bottom are each a status bar container I have developed. While these ones are pretty simple, I have properties that allow it to also show left and right content, as well as a spinner or progress bar.

Every control in the entire project is private. No window or container can reference any control on any other container. Most properties are private as well. This essentially creates a whole bunch of mini programs, each responsible for its own inputs and outputs. Nothing more, nothing less.

1 Like

Because the Controls draw color is too light (I do not see them - nearly), for build process, I use a background color for the window (orange here), so I can see what I am doing.

When done, I remove that color. In another window, it’s yellow (under construction).

Here’s the main window:

The PopupMenu allow to choose different kinds of useful location (different .sqlite files):
ListBox
TextFields
TextAreas
PushButtons
Labels.

Xojo 2025r1.1.