CAppDialog in Expert Advisors - terminal freezing after closing - page 2

 
Mohammad Hossein Sadeghi:

I believe the best way is to create an instance of the class by 'new' keyword, define a pointer in global scope, create an instance of it in OnInit() by 'new' keyword and assign it to the pointer, then delete it in OnDeinit(), it is well described in the following post:

https://www.mql5.com/en/forum/64619/page2#comment_2052954

Another work around would be setting 'm_deinit_reason' to WRONG_VALUE by overriding CAppDialog::Create function virtually, since it is a public method of the class and it is the only function that calls CreateCommon, and then use the new derived class instead.

Mohammad, a great solution. There is one question. How to access the methods of the created instance of the object in the body of the CMyAppDialog :: Create procedure?

What is the syntax?

 
Mohammad Mohi:

This really helped me as I faced the same issue, I want to share shorter work-around, since the issue occurs only in Experts, the we may only need to override the CAppDialog::Destroy and defining member variables and check if the calling program is Indicator or Expert are not mandatory.

In the derived class CPanelDialog, override Destroy function under public keyword:

then define it as below:

i just can say : WONDERFUL ... THANK YOU VERY MUCH

 
Mohammad Hossein Sadeghi:

I believe the best way is to create an instance of the class by 'new' keyword, define a pointer in global scope, create an instance of it in OnInit() by 'new' keyword and assign it to the pointer, then delete it in OnDeinit(), it is well described in the following post:

https://www.mql5.com/en/forum/64619/page2#comment_2052954

Another work around would be setting 'm_deinit_reason' to WRONG_VALUE by overriding CAppDialog::Create function virtually, since it is a public method of the class and it is the only function that calls CreateCommon, and then use the new derived class instead.

Thank you very much dude! Saved my life 👍 👍 👍