This article presents an alternative method of GUI creation based on
layouts and containers, using one layout manager — the CBox class. The
CBox class is an auxiliary control that acts as a container for
essential controls in a GUI panel. It can make designing graphical
panels easier, and in some cases, reduce coding time.
Absolute positioning of controls within
an application dialog window is the most direct way of creating a
graphical user interface for an application. However, in some cases,
this approach to graphical user interface
(GUI) design can be inconvenient, or even impractical. This article
presents an alternative method of GUI creation based on layouts and
containers, using one layout manager — the CBox class.
The layout manager class implemented and
used in this article is roughly equivalent to those found in some
mainstream programming languages such as BoxLayout (Java) and Pack geometry manager (Python/Tkinter).
3.1. Layout Styles
CBox has two layout styles: vertical style and horizontal style.
A horizontal style would have the following basic layout:
Figure 2. Horizontal Style (Centered)
A vertical style would have the following basic layout:
Figure 3. Vertical Style (Centered)
CBox would use a horizontal style by default.
Using a combination of these two layouts
(possibly using multiple containers), it is possible to recreate
virtually any type of GUI panel design. Furthermore, placing controls
within containers would allow for a segmented design. That is, it allows
one to customize the sizes and positioning of the controls in a given
container, without affecting those held by other containers.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
New article Using Layouts and Containers for GUI Controls: The CBox Class has been published on mql5.com:
This article presents an alternative method of GUI creation based on layouts and containers, using one layout manager — the CBox class. The CBox class is an auxiliary control that acts as a container for essential controls in a GUI panel. It can make designing graphical panels easier, and in some cases, reduce coding time.
Absolute positioning of controls within an application dialog window is the most direct way of creating a graphical user interface for an application. However, in some cases, this approach to graphical user interface (GUI) design can be inconvenient, or even impractical. This article presents an alternative method of GUI creation based on layouts and containers, using one layout manager — the CBox class.
The layout manager class implemented and used in this article is roughly equivalent to those found in some mainstream programming languages such as BoxLayout (Java) and Pack geometry manager (Python/Tkinter).
3.1. Layout Styles
CBox has two layout styles: vertical style and horizontal style.
A horizontal style would have the following basic layout:
Figure 2. Horizontal Style (Centered)
A vertical style would have the following basic layout:
Figure 3. Vertical Style (Centered)
CBox would use a horizontal style by default.
Using a combination of these two layouts (possibly using multiple containers), it is possible to recreate virtually any type of GUI panel design. Furthermore, placing controls within containers would allow for a segmented design. That is, it allows one to customize the sizes and positioning of the controls in a given container, without affecting those held by other containers.
Author: Enrico Lambino