Discussion of article "MQL as a Markup Tool for the Graphical Interface of MQL Programs. Part 1"

 

New article MQL as a Markup Tool for the Graphical Interface of MQL Programs. Part 1 has been published:

This paper proposes a new conception to describe the window interface of MQL programs, using the structures of MQL. Special classes transform the viewable MQL markup into the GUI elements and allow manage them, set up their properties, and process the events in a unified manner. It also provides some examples of using the markup for the dialogs and elements of a standard library.

Why is layout separated from code and described in a special language? Here are the basic benefits of such approach.

  • Visual presentation of hierarchic relations among elements and containers;
  • Logical grouping;
  • Unified definition of layout and alignment;
  • Easily writing the properties and their values;
  • Declarations allow implementing the automatic generation of the code maintaining the lifecycle and control of elements, such as creating, setting up, interactiing, and deleting;
  • Generalized abstraction level, i.e., general properties, states, and initialization/processing phases, which allows developing the GUI independently on coding;
  • Repeated (multiple) uses of layouts, i.e., the same fragment can be included in different dialogs several times;
  • Dynamic content implementation/generation on-the-fly, in a manner similar to switching among tabs, a specific set of elements being used for each of them;
  • Dynamic creation of "controls" inside the layout, saving them in a single array of pointers to the basic class, such as CWnd, in case of the standard MQL library; and
  • Using a specific graphic editor for the interactive interface design — in this case, the special format of describing the layouts acts as a connecting link between the external representation of the program and its executive part in the programming language.

For the MQL environment, just a few shots have been made at solving some of these problems. Particularly, a visual dialog designer is presented in the article How to Design and Construct Object Classes. It works based on the MasterWindows library. However, the ways of arranging layouts and the list of element types supported are considerably limited in it.

A more advanced layout system, although without a visual designer, is proposed in the articles Using Layouts and Containers for GUI Controls: The CBox Class and The CGrid Class. It supports all standard control elements and other ones, inherited from CWndObj or CWndContainer, but still leaves the routine coding aimed at creating and arranging components to the user.

Conceptually, this approach with containers is very advanced (if suffices to mention its popularity in practically all markup languages). Therefore, we are going to take heed of it. In one of my earlier articles (Applying OLAP in Trading (Part 2): Visualizing the Interactive Multidimensional Data Analysis Results), I proposed a modification of containers CBox and CGrid, as well as some control elements to support the "rubber" properties. Below, we're going to use those developments and improve them to solve the problem of automatically arranging elements, exemplified by the objects of a standard library.

Author: Stanislav Korotky

Reason: