My panel breakout, when i change timeframe. - page 2

 
Trinh Dat:
Oh, it ever work good. today it make error when compile again with new version MT4


What you think. what is the problem. I think this solution should come from MQL5.com administrator

 
I think error from new version of MT4.
 
Trinh Dat:
I think error from new version of MT4.


any comment from moderator for this solution. or may be we have to wait for next version

 
I have the same error, any suggestions?
 

I had the same Problem.

I had an instance of a MyDialog (derived from CAppDialog) as global variable in an EA,  like this:

MyDialog myDialog;

In the OnDeinit function I called  myDialog.Destroy(reason);

Before the last update of MT5 (now I have build 1210) everything worked fine.

I found out, that the Destroy-Method of CAppDialog has changed:

Pre update:

//+------------------------------------------------------------------+
//| Application dialog deinitialization function                     |
//+------------------------------------------------------------------+
void CAppDialog::Destroy(const int reason)
  {
   m_deinit_reason=reason;
//---
   IniFileSave();
//--- detach chart object from chart
   m_chart.Detach();
//--- call parent destroy
   CDialog::Destroy();
//---
   if(reason==REASON_PROGRAM)
     {
      if(m_program_type==PROGRAM_EXPERT)
         ExpertRemove();
      if(m_program_type==PROGRAM_INDICATOR)
         ChartIndicatorDelete(m_chart_id,m_subwin,m_indicator_name);
     }
//--- send message
   EventChartCustom(m_chart_id,ON_APP_CLOSE,m_subwin,0.0,m_program_name);
  }

 After update to build 1210:

//+------------------------------------------------------------------+
//| Application dialog deinitialization function                     |
//+------------------------------------------------------------------+
void CAppDialog::Destroy(const int reason)
  {
//--- destroyed already?
   if(m_deinit_reason!=WRONG_VALUE)
      return;
//---
   m_deinit_reason=reason;
   IniFileSave();
//--- detach chart object from chart
   m_chart.Detach();
//--- call parent destroy
   CDialog::Destroy();
//---
   if(reason==REASON_PROGRAM)
     {
      if(m_program_type==PROGRAM_EXPERT)
         ExpertRemove();
      if(m_program_type==PROGRAM_INDICATOR)
         ChartIndicatorDelete(m_chart_id,m_subwin,m_indicator_name);
     }
//--- send message
   EventChartCustom(CONTROLS_SELF_MESSAGE,ON_APP_CLOSE,m_subwin,0.0,m_program_name);
  }

 So the first call of the Method does still what I expect, but the next call will do nothing because m_deinit_reason won't be a "WRONG_VALUE".

I use the following workaround:

//+------------------------------------------------------------------+
//| Global Variables                                                 |
//+------------------------------------------------------------------+
MyDialog *myDialog;

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
      myDialog = new MyDialog;
  
      if (!myDialog.Create(0,"My Dialog",0,2,25,150,180)){
         return(INIT_FAILED); 
      }
      
      if(!myDialog.Run()){
         return(INIT_FAILED);
      }  

   return(INIT_SUCCEEDED);
  }

//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   
   myDialog.Destroy(reason);
   delete myDialog;
      
  }

 So every time I change the time frame, the dialog will be fully killed an instanciated newly.

I would appreciate any suggestions for a better way :)

 
Stevie_M #:

I had the same Problem.

I had an instance of a MyDialog (derived from CAppDialog) as global variable in an EA,  like this:

MyDialog myDialog;

In the OnDeinit function I called  myDialog.Destroy(reason);

Before the last update of MT5 (now I have build 1210) everything worked fine.

I found out, that the Destroy-Method of CAppDialog has changed:

Pre update:

 After update to build 1210:

 So the first call of the Method does still what I expect, but the next call will do nothing because m_deinit_reason won't be a "WRONG_VALUE".

I use the following workaround:

 So every time I change the time frame, the dialog will be fully killed an instanciated newly.

I would appreciate any suggestions for a better way :)

Very useful information! Thanks.