dialog class and a subwindow

 

hello,


"hIndicator_dialog_class_only.mq4" is an indicator which creates a dialog class 

#property indicator_chart_window

//+------------------------------------------------------------------+

#include <Controls\Dialog.mqh>

class hClass: public CAppDialog{

   public:

                     hClass();

                    ~hClass();

};

hClass:: hClass(){}

hClass::~hClass(){}

//+------------------------------------------------------------------+

hClass eClass;

//+------------------------------------------------------------------+

int OnInit(){

   eClass.Create(0,"e",0,1,1,100,200);

   eClass.Run();

   return(INIT_SUCCEEDED);

}

//------------------------------------------------------------------+

void OnDeinit(const int reason){

   eClass.Destroy(reason);

}

//+------------------------------------------------------------------+

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){

   eClass.OnEvent(id,lparam,dparam,sparam);

}

//+------------------------------------------------------------------+

...and works fine :

n1


Here is "hIndicator_class_and_indicator.mq4" on which i try to open the same dialog class ...and also a subwindow.

#property indicator_separate_window

#property indicator_buffers 1

#property indicator_plots   1

//+------------------------------------------------------------------+

#include <Controls\Dialog.mqh>

class hClass: public CAppDialog{

   public:

                     hClass();

                    ~hClass();

};

hClass:: hClass(){}

hClass::~hClass(){}

//+------------------------------------------------------------------+

hClass eClass;

//+------------------------------------------------------------------+

double         Label1Buffer[];

//------------------------------------------------------------------+

int OnInit(){

   SetIndexBuffer(0,Label1Buffer); SetIndexLabel(0,"Label1"); SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 1, clrRed);

   eClass.Create(0,"e",0,1,1,100,200);

   eClass.Run();

   return(INIT_SUCCEEDED);

}

//------------------------------------------------------------------+

void OnDeinit(const int reason){

   eClass.Destroy(reason);

}

//------------------------------------------------------------------+

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){

   eClass.OnEvent(id,lparam,dparam,sparam);

}

But it doesnt give what as expected :

n2


So what to modify to obtain dialog class on upper left corner and an indicator subwindow under the main chart ?

thanks