How to calculate CAppDialog Minimize or Maximize status?

 
Greetings Members,

I have a question. How to get the minimized or maximized state status of the CAppDialog? Need to programmatically figure out whether the current window is in minimize state or in maximize state.

Tried following way with global variable:
int minimized_status = 0;

//---Custom function---
class CAppDialogExample : public CAppDialog
  {
public:
   //--- chart event handler
   virtual bool      OnEvent(const int id,const long &lparam,const double &dparam,const string &sparam);
private:
   void              OnClickButtonMinMax(){if(minimized_status == 0) minimized_status = 1; else minimized_status = 0;}
  };
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
EVENT_MAP_BEGIN(CAppDialogExample)
EVENT_MAP_END(CAppDialog)

It does change the minimized_status value on each click. But the problem is CAppDialog is no longer getting minimized after using this code.

Any easy method?
Thank you
Regards

 
Somsri Sarkar:
Greetings Members,

I have a question. How to get the minimized or maximized state status of the CAppDialog? Need to programmatically figure out whether the current window is in minimize state or in maximize state.

Tried following way with global variable:

It does change the minimized_status value on each click. But the problem is CAppDialog is no longer getting minimized after using this code.

Any easy method?
Thank you
Regards

always check the documentation

https://www.mql5.com/en/docs/standardlibrary/controls/cappdialog/cappdialogminimized

Documentation on MQL5: Standard Library / Panels and Dialogs / CAppDialog / Minimized
Documentation on MQL5: Standard Library / Panels and Dialogs / CAppDialog / Minimized
  • www.mql5.com
Minimized(const bool) - CAppDialog - Panels and Dialogs - Standard Library - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 

Thank you for your reply. Unfortunately, have tried it, no change. On clicking the minimize button its only changing the icon, main window is not minimizing with the custom function.

void OnClickButtonMinMax(){
if(minimized_status == 0) {minimized_status = 1;main_window.Minimized(true);} 
else {minimized_status = 0;main_window.Minimized(false);}
}

Seems like custom function code has some issue, but unable to detect.

 
Somsri Sarkar #:

Thank you for your reply. Unfortunately, have tried it, no change. On clicking the minimize button its only changing the icon, main window is not minimizing with the custom function.

Seems like custom function code has some issue, but unable to detect.

That’s not what you asked. You wanted to determine the status

You will need to post your code to get an answer for your issue
 
Somsri Sarkar #:

Thank you for your reply. Unfortunately, have tried it, no change. On clicking the minimize button its only changing the icon, main window is not minimizing with the custom function.

Seems like custom function code has some issue, but unable to detect.

CAppDialog has that property by default (m_minimized):

   void              Minimized(const bool flag) { m_minimized=flag; }

 Also you need to use the Minimize Maximize methods instead of Minimize(true | false)

void OnClickButtonMinMax(){
if(minimized_status == 0) {minimized_status = 1;main_window.Minimize();} 
else {minimized_status = 0;main_window.Maximize();}
}
 
Laszlo Tormasi #:

CAppDialog has that property by default (m_minimized):

 Also you need to use the Minimize Maximize methods instead of Minimize(true | false)

Thank you so much! That just worked perfectly.  Learned a new thing.

Regards