Discussion of article "How to create a graphical panel of any complexity level" - page 3

 
el_looto :

When placing a Panel into these control objects, such as in the example code ControlsPanel.mq5 (given here :  https://www.mql5.com/en/docs/standardlibrary/controls/cpanel  ) minimizing then restoring the panel resizes all panels to be the same size as the control;

On Startup:

https://www.mql5.com/en/charts/10905636/nzdjpy-h1-go-markets-pty

After Minimize/Restore:

https://www.mql5.com/en/charts/10905637/nzdjpy-h1-go-markets-pty

Is there any way to avoid this or is nesting Panels impossible, despite the implication of the documentation?

This article is an example of an alternative way to create panels.

Although I always liked the standard way (I recommend that you use the standard method)

  • [data folder]\MQL5\Experts\Examples\Controls\Controls.mq5
  • [data folder]\MQL5\Indicators\Examples\Panels\ChartPanel\ChartPanel.mq5
  • [data folder]\MQL5\Indicators\Examples\Panels\SimplePanel\SimplePanel.mq5
 

Hello Vladimir,


Can you please explain how to create multicolumn listbox

 
flagcandles :

Hello Vladimir,


Can you please explain how to create multicolumn listbox

This is something like a table to do.

 

Hey Guys, 

question from a self learner!

When we create panels with the library how do we put the panel in a corner that is different form the topleft?

I fiddled with OBJ_PROP_Corner but I think there is a better way by using Panel.Align and Panel.Alignment. I played around but as a non programmer I don't know what parameters to pass and how to pass them. For example the Panel.Alignment(CRect &rect) what do those Rect things mean?

Any light much appreciated


cheers

Diego

 
Diego :

Hey Guys, 

question from a self learner!

When we create panels with the library how do we put the panel in a corner that is different form the topleft?

I fiddled with OBJ_PROP_Corner but I think there is a better way by using Panel.Align and Panel.Alignment. I played around but as a non programmer I don't know what parameters to pass and how to pass them. For example the Panel.Alignment(CRect &rect) what do those Rect things mean?

Any light much appreciated


cheers

Diego

At the time of creating the panel, we indicate the coordinates. Example for the file AppWindowEditDefine.mq5

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
   
***
//--- create application dialog
   if(!ExtDialog.Create(0,"AppWindow Edit Define",0,40,40,380,344))
      return(INIT_FAILED);
//--- run application
 

I noticed that often times the *.Destroy() function simply doesn't work. It leaves objects on the chart after the Expert Deinit() function is called, especially when rapidly changing timeframes.

A simple workaround is to use pointers, instead of directly creating, modifying, and destroying the CAppDialog object.

CAppDialog AppWindow;		//Declare CAppDialog object

AppWindow.Destroy(...);		//Destroy Window object(s)

The above functions now become this:

CAppDialog *AppWindow;		//Declare CAppDialog pointer
AppWindow = new CAppDialog();	//Create new CAppDialog object at ptr address

AppWindow.Destroy(...);		//Destroy Window object(s)
delete AppWindow;		//Set the "delete" flag for objects at the ptr address (in case *.Destroy() fails)
AppWindow = NULL;		//Set the ptr address to NULL

After building my custom window class, I also create and destroy all Buttons, Panels, and other objects like this. Works like a charm!


*Note: Setting the delete flag and pointer to NULL might be overkill, but I have not had left-over objects since implementing.

Documentation on MQL5: Checkup / Point
Documentation on MQL5: Checkup / Point
  • www.mql5.com
Checkup / Point - Reference on algorithmic/automated trading language for MetaTrader 5
 
MetaQuotes:

New article How to create a graphical panel of any complexity level has been published:

Author: Vladimir Karputov

Thank you very much for share. Excellent!

I missed just one thing in your example. You should help how to include data information as text and numbers.

For example:

Stop Loss Value:50.50

Take Profit Value: 250.00

Moving Average (200): 110.5.


Do you know any article to teach how to do this kind of thing?

 
Guilherme Mendonca :

Thank you very much for share. Excellent!

I missed just one thing in your example. You should help how to include data information as text and numbers.

For example:

Stop Loss Value:50.50

Take Profit Value: 250.00

Moving Average (200): 110.5.


Do you know any article to teach how to do this kind of thing?

Check out the standard panel examples in the MetaEditor.

 
Very useful, thanks for posting.
Quick question,

How come you use the following;
//--- create application dialog
   if(!AppWindow.Create(0,"AppWindow",0,20,20,360,324))
      return(INIT_FAILED);
//--- run application
   AppWindow.Run();
//--- succeed
   return(INIT_SUCCEEDED);
  }
Instead of;
//--- create application dialog
   AppWindow.Create(0,"AppWindow",0,20,20,360,324));
//--- run application
   AppWindow.Run();
/
  }
Which I used in a mql4 GUI.

Is this an mql5 necessity or does it have other benefits?

Thanks
 
emargrie :
Very useful, thanks for posting.
Quick question,

How come you use the following;
Instead of;
Which I used in a mql4 GUI.

Is this an mql5 necessity or does it have other benefits?

Thanks

If YOU really do not see the difference, you urgently need to throw away the old terminal. The old terminal affects you badly. Unfortunately, the old terminal taught you to write very dangerous code - you are used to writing code WITHOUT CHECKS to return errors.

Reason: