Libraries: CComment Class

 

CComment Class:

The ССomment class was designed to extend the capabilities of the standard Comment function. Its purpose is to display a multi-line comment on a panel. Methods of this class allow you to specify text color, font, style and line spacing. You can move the panel within the screen space with the mouse.

For the purpose of backwards compatibility, we preserved the standard way of outputting the comment in the upper left corner of the chart. The class has the ability to automatically adjust the colors in case the color scheme is changed regularly. In this mode, the background color is analyzed and contrasting text color is set automatically.

The panel is useful for displaying main settings of an Expert Advisor. An example of such EA is included. Its code is compatible with MQL4.

Author: Andrey Voytenko

 
Automated-Trading:

CComment class:

Author: Andrey Voytenko

Useful thing, thanks!
 
A really useful class, I agree.
 
Automated-Trading:

CComment Class:

Author: Andrey Voytenko


Thanks for the awesome tool! I modded it a bit to suit my needs so I'm going to post it here... 


I added a Zone method that return a bool if the x,y on chart click was on the comment window so nothing behind it can get activated. I also overrode the OnChartEvent method to move the comment when resizing the window. 

Files:
MyComment.mqh  4 kb
 
I came here to write thanks to the author for this add-on!
It makes working on Expert Advisors very easy and fast.
Thank you very much!
 
It's great, but how to remove (or reduce) the space between the top of the frame and the first line of text?
 
Hello, how do I start it in the bottom left corner?

I changed the properties of the object to LEFT_LOWER but when it is time to move it, it moves inverted.

Thanks!!!


 
Thanks for your comment class, it's very useful.  I'm using it to help build my EA.
 
Is there a way to use tab or /t or anything similar, such that words or numbers can be placed below each other in a straight column?
 
Flying Dutchman #:
Is there a way to use tab or /t or anything similar, such that words or numbers can be placed below each other in a straight column?

You can use spaces within the string like this:

comment_panel.SetText(3,"xxxxxxxxxxxxxxxxxx:         "+ string(a),COLOR_WIN);
comment_panel.SetText(4,"yyyyyyyyyyyyyyy:            "+ string(b),COLOR_WIN);
comment_panel.SetText(5,"zzzzzzzzzzzzzzzzzzzzzzzzzz: "+ string(c),COLOR_WIN);

Happy coding!
 

First, Thank you for making this. 

I found a bug that when we move the panel and later call the show method to update some comment, the panel returns to its original location on the chart. Is there a modification that can be done on the comment.mql for it to retain the moved location?