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

 

New article Using Layouts and Containers for GUI Controls: The CGrid 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 CGrid class. The CGrid class is an auxiliary control that acts as a container for other containers and controls using a grid layout.

The CGrid class is a layout manager used in the design of GUI controls for dialog windows in MetaTrader. It is one of the custom container classes that can be used in GUI design without relying on absolute positioning.

It is highly recommended to read the article about the CBox class before proceeding to the concepts discussed in this article.


3. The CGrid Class

The CGrid class creates a container for one or more GUI controls and presents them in a grid arrangement. An example layout of an instance of the CGrid class is shown in the following illustration:

CGrid Layout

Figure 1. Grid Layout

Using this class can be convenient especially if the controls to be added to the grid have identical dimensions, such as a set of buttons or edit boxes within the client area.

The example above is a grid of 4x4 cells (4 columns and 4 rows). However, we aim to develop a class that would be able to accommodate any number of rows and columns in a grid.

Author: Enrico Lambino

Reason: