Problem with CPanel Alignment

 

Hello Folks,

This is my first post on the Forum, so I'll try my best to explain myself clearly. I'm developing a CAppDialog and, among other things, I want to place a CPanel on it, aligned to the Right. Following the Docs example (here), with a few minor adjustments as follows (lines highlighted in yellow):

//+------------------------------------------------------------------+
//| Create the "CPanel"                                              |
//+------------------------------------------------------------------+
bool CControlsDialog::CreatePanel(void)
  {
//--- coordinates
   int x1=20;
   int y1=20;
   int x2=ExtDialog.Width()/3;
   int y2=ExtDialog.Height()/3;
//--- create
   if(!my_white_border.Create(0,ExtDialog.Name()+"MyWhiteBorder",m_subwin,x1,y1,x2,y2))
      return(false);
   if(!my_white_border.ColorBackground(clrAqua)) //changed the color to clrAqua
      return(false);
   if(!my_white_border.ColorBorder(clrAqua))
      return(false);
   if(!ExtDialog.Add(my_white_border))
      return(false);
   my_white_border.Alignment(WND_ALIGN_RIGHT,0,0,10,10); //this line at the Docs example was: my_white_border.Alignment(WND_ALIGN_CLIENT,0,0,0,0);
//--- succeed
   return(true);
  }

Everything else of the example code is equal. So, the first compiling produced the Aqua panel aligned to the left (what is wrong, given the .Alignment() ): printscreen "CPanel compiling 1"


After minimizing the Dialog and maximizing it again, the aqua panel was correctly (i.e., what I believe I coded) placed to the right:  printscreen "CPanel after minimizing"


I tried placing the my_white_border.Alignment(WND_ALIGN_RIGHT,...) line at various random places inside the code without success, even calling the CControlsDialog::Maximize, or other things, but I'm failing to understand how to correctly align it.


Any help would be appreciated!


Best regards, Gabriel!

Documentation on MQL5: Standard Library / Panels and Dialogs / CPanel
Documentation on MQL5: Standard Library / Panels and Dialogs / CPanel
  • www.mql5.com
CPanel - Panels and Dialogs - Standard Library - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5