Discussion of article "Graphical Interfaces IV: the Multi-Window Mode and System of Priorities (Chapter 2)"
Anatoly, I noticed a bug - I decided to look at the examples and immediately saw that if the window is pressed to the right edge and tooltips are enabled, these tooltips go beyond the right edge of the screen. Would you correct the x-coordinate when the tooltip goes off the screen?
And another suggestion: in menus, in menu items with drop-down submenus (I do not know how to call them correctly), in those where there is a right arrow indicating that another item will open, I think it is better to make the opening when hovering the cursor over such a menu item (a la Windows). Or make it a parameter: either a new item is opened by hovering or by clicking (as it is now).
Anatoly, I noticed a bug - I decided to look at the examples and immediately saw that if the window is pressed to the right edge and tooltips are enabled, these tooltips go beyond the right edge of the screen. Would you correct the x-coordinate when the tooltip goes off the screen?
And another suggestion: in menus, in menu items with drop-down submenus (I do not know how to call them correctly), in those where there is a right arrow indicating that another item will open, I think it is better to make the opening when hovering the cursor over such a menu item (a la Windows). Or make it a parameter: either a new item is opened by hovering or by clicking (as it is now).
We'll do it. We will make corrections and improvements after the first version of the library is fully published. We need to fix the current result.
Then we'll make a list of what needs to be done, define priorities and we can try to publish a separate article.
New article Graphical Interfaces IV: the Multi-Window Mode and System of Priorities (Chapter 2) has been published:
Author: Anatoli Kazharski
Thank you for the excellent series of articles. I enjoyed reading the MQL4 codes. Program.mqh is the following two error:
//error#1: array out of range in 'Program.mqh' (753,32) //Fixed by changing lines 742-746 string text[2]= { "\"Icon button\" (1) control", "Opens the dialog box (2)." }; //error#2: array out of range in 'Program.mqh' (1012,32) //Fixed by changing lines 1000-1005 string text[3]= { "\"Icon button\" (5) control", "This is the second line of the tooltip.", "This is the third line of the tooltip." };
Thank you for the excellent series of articles. I enjoyed reading the MQL4 codes. Program.mqh is the following two error:
Thank.
In my version of these errors not.
742-746:
//+------------------------------------------------------------------+ //| Tooltip 1 | //+------------------------------------------------------------------+ bool CProgram::CreateTooltip1(void) { #define TOOLTIP1_LINES_TOTAL 2 //--- m_tooltip1.WindowPointer(m_window1); m_tooltip1.ElementPointer(m_icon_button1); //--- string text[]= { "Line 1", "Line 2" }; //--- m_tooltip1.Header("Icon Button 1"); m_tooltip1.XSize(250); m_tooltip1.YSize(70); //--- for(int i=0; i<TOOLTIP1_LINES_TOTAL; i++) m_tooltip1.AddString(text[i]); //--- if(!m_tooltip1.CreateTooltip(m_chart_id,m_subwin)) return(false); //--- CWndContainer::AddToElementsArray(0,m_tooltip1); return(true); }
//---
1000-1005:
//+------------------------------------------------------------------+ //| Tooltip 5 | //+------------------------------------------------------------------+ bool CProgram::CreateTooltip5(void) { #define TOOLTIP5_LINES_TOTAL 3 //--- m_tooltip5.WindowPointer(m_window1); m_tooltip5.ElementPointer(m_icon_button5); //--- string text[]= { "Line 1", "Line 2", "Line 3" }; //--- m_tooltip5.Header("Icon Button 5"); m_tooltip5.XSize(250); m_tooltip5.YSize(80); //--- for(int i=0; i<TOOLTIP5_LINES_TOTAL; i++) m_tooltip5.AddString(text[i]); //--- if(!m_tooltip5.CreateTooltip(m_chart_id,m_subwin)) return(false); //--- CWndContainer::AddToElementsArray(0,m_tooltip5); return(true); }
Thank.
In my version of these errors not.
742-746:
//---
1000-1005:
It looks like Kaleem uses a slightly outdated platform version.
But for the sake of clarity and making less error-prone, the source code should be changed to define the arrays with explicit sizes as text[TOOLTIP1_LINES_TOTAL] and text[TOOLTIP5_LINES_TOTAL]. Otherwise you can get out of bounds error in future if arrays will change but defines will not by an omission.
It looks like Kaleem uses a slightly outdated platform version.
But for the sake of clarity and making less error-prone, the source code should be changed to define the arrays with explicit sizes as text[TOOLTIP1_LINES_TOTAL] and text[TOOLTIP5_LINES_TOTAL]. Otherwise you can get out of bounds error in future if arrays will change but defines will not by an omission.
I am using MetaTrader 4 Version: 4.00 Build 950. Isn't this the latest version?
Anatoly, is it possible to make it possible to open two windows from the main panel so that all three windows remain active?
I.e.: we have a main panel, it has buttons to open two additional panels, each of these additional panels has its own set of buttons and other things.
Press button1 on the main panel - panel1 is opened. Buttons on the main panel remain active and on panel1 they are also active.
Press button2 on the main panel when panel1 is already open - panel2 opens. All buttons on the main panel, on panel1 and on panel2 remain active.
This will allow to have an inerface with movable active panels, each of which performs its own functions.
Now it is possible to have only one active panel at a time.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
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