How to create new Class (object) to be able to use Add method from CAppDialog class

 

My goal is to create test class with  two CWndClient  members (two rectangles )  but in the  main file I'd like to be able to add this object to

CAppDialog as a single object and to be able  to use .Add Method      so those two members would be move with main window (mouse)  ...but I'm the beginner so there is a mistake in the code :) .

No errors but the only clsDialog is moving      ....im not testing "IF" correct   ..just trying to understand general idea  ....i found this article and is awesome https://www.mql5.com/en/articles/4503  but I'd  like to create separate class . if understand the concept like to create an objecte to be  able to add the to my future projects    ....this is just to learn the principle (2 Wnd objects as single class , and i can  .Add    this class  to CAppDialog)   ..is there article about this  ...or how to search in google for it ???

#property indicator_chart_window

#include<Controls\Dialog.mqh>
#include <Controls\WndClient.mqh>

//+------------------------------------------------------------------+
class classTempClass  : public CWndClient
  {
private :
   CWndClient        clsWnd;
   CWndClient        clsWndS1;
public :
   void              classTempClass(void);
  };
//+------------------------------------------------------------------+
void classTempClass::classTempClass(void)
  {
   clsWnd.Create(0,"insiceClass",0,30,30,60,60);
   clsWndS1.Create(0,"insiceClassS1",0,70,70,190,190);
   clsWndS1.ColorBackground(clrRed);
   clsWnd.Add(clsWndS1);
   clsWndS1.Show();
  }
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
// MAIN Program

CAppDialog clsDialog;
classTempClass clsTempWnd;

int OnInit()
  {
   clsDialog.Create(0,"rtertetr",0,50,50,400,400);
   clsDialog.Run();
   clsDialog.Add(clsTempWnd);
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,const int prev_calculated,const datetime &time[],const double &open[],const double &high[],const double &low[],
                const double &close[],const long &tick_volume[],const long &volume[],const int &spread[])
  {

   return(rates_total);
  }
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
   clsDialog.ChartEvent(id,lparam,dparam,sparam);
  }
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   clsDialog.Destroy(reason);
  }
//+------------------------------------------------------------------+
How to create a graphical panel of any complexity level
How to create a graphical panel of any complexity level
  • 2018.04.26
  • Vladimir Karputov
  • www.mql5.com
Even now most programmers, who develop indicators and Expert Advisors for the MetaTrader 5 platform, do not use the available graphical interface creation capabilities in their applications. I believe this is because Panels and Dialogs classes of the Standard Library only provide a brief technical description of methods. The language reference...
Reason: