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
{
protected:
//--- Index of the active windowint 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.
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 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.
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.
Author: Anatoli Kazharski