New article: Using Layouts and Containers for GUI Controls: The CBox Class

Back to topics list To post a new topic, please log in or register
avatar
Moderator
72408
MetaQuotes 2015.07.09 14:00
 

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:

Horizontal Style for CBox

Figure 2. Horizontal Style (Centered)

A vertical style would have the following basic layout:

Vertical Style for CBox

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

Back to topics list  

To add comments, please log in or register