Download MetaTrader 5

New article: Graphical Interfaces IV – the Multi-Window Mode and System of Priorities (Chapter 2)

To add comments, please log in or register
MetaQuotes Software Corp.
MetaQuotes Software Corp.  

New article Graphical Interfaces IV: the Multi-Window Mode and System of Priorities (Chapter 2) has been published:

In this chapter, we will extend the library implementation to the possibility of creating multi-window interfaces for the MQL applications. We will also develop a system of priorities for left mouse clicking on graphical objects. This is required to avoid problems when elements do not respond to the user's actions.

The Multi-Window Mode

Let us consider the multi-window mode of the graphical interface of the library under development. Up to now, the ENUM_WINDOW_TYPE enumeration provided two identifiers for the main (W_MAIN) and dialog (W_DIALOG) windows. The single-window mode was the only mode in use. After we introduce some additions, enabling the multi-window mode will simply involve the creation and addition of the required number of control forms to the base.

In the main class for event handling CWndEvents create a field for storing the index of the currently active window.

class CWndEvents : public CWndContainer
   //--- Index of the active window
   int               m_active_window_index;

Let us see how the index of the active window is going to be identified. For instance, the user assigns the opening of a dialog window (W_DIALOG) to some button. When the button is pressed, the ON_CLICK_BUTTON custom event is generated. This event can be tracked in the CProgram::OnEvent() event handler of the custom class. We will also use the CWindow::Show() method of the form which is to be shown. It is not sufficient in the current implementation of the library and we will introduce necessary additions.

Fig. 2. Library structure at the current stage of development.

Author: Anatoli Kazharski

To add comments, please log in or register