This is an MQL5 documentation page. I was trying to work with function pointers and understand the differences between MQL5 and C++. However, the logic explained in the MQL5 documentation doesn’t even work in their own compiler. This is a formal documentation—how can they make such a major mistake and waste programmers' time struggling with it? Just try to complie full source code in the end of page.
Is because the class inherits the Save method from CObject. Just add a context operator saying the compiler to use function defined in global scope.
AddButton(new MyButton("Save",::Save));
Is because the class inherits the Save method from CObject. Just add a context operator saying the compiler to use function defined in global scope.
Yes, you wrote it correctly. There is no mistake in the documentation.
We will correct the documentation
//+------------------------------------------------------------------+ //| Create and add buttons to the CControlsDialog panel | //+------------------------------------------------------------------+ bool CControlsDialog::CreateButtons(void) { //--- calculate buttons coordinates int x1=INDENT_LEFT; int y1=INDENT_TOP+(EDIT_HEIGHT+CONTROLS_GAP_Y); int x2; int y2=y1+BUTTON_HEIGHT; //--- add buttons objects together with pointers to functions AddButton(new MyButton("Open",Open)); AddButton(new MyButton("Save",::Save)); AddButton(new MyButton("Close",Close)); //--- create the buttons graphically for(int i=0;i<m_buttons.Total();i++)
We will correct the documentation
Done

- www.mql5.com

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
This is an MQL5 documentation page. I was trying to work with function pointers and understand the differences between MQL5 and C++. However, the logic explained in the MQL5 documentation doesn’t even work in their own compiler. This is a formal documentation—how can they make such a major mistake and waste programmers' time struggling with it? Just try to complie full source code in the end of page.