Libraries: Class СBmpButtonTransparent

 

Class СBmpButtonTransparent:

A class for a transparent button.

The class and examples were developed for a competition arranged by TheXpert.

Author: Andrey Miguzov

[Deleted]  
I look at the code of CBmpButton class from the standard MQL5 library and see the similarity. Is it an accident or did one of these classes serve as a prototype?
 
Konstantin Karpov:
I look at the code of CBmpButton class from the standard MQL5 library and see the similarity. Is it an accident or did one of these classes serve as a prototype?
Yes, of course - CBmpButton was taken as a basis. And 90 per cent reworked :) The parent class CWndObj had to be tweaked a bit with the help of inheritance. This was done for compatibility with the standard library.
[Deleted]  
Andrey Miguzov:
Yes of course - CBmpButton was taken as a basis. And 90 per cent reworked :) The parent class CWndObj had to be slightly modified using inheritance. This was done for compatibility with the standard library.
So why the developers will not include this class in their standard library, because the class is necessary. By the way, it would be good to get a full description of its methods, because you have to get into the code and read the methods, guessing what they are needed for....
 
Konstantin Karpov:
By the way, it would be good to get a full description of its methods, because you have to get into the code and read the methods, guessing what they are needed for....
I agree. I will add it as soon as I have time.
[Deleted]  

Before you make a description, please tell me which method changes the position of a graphical object on the chart. The Top(aLocation) method from the CWnd class does not change it. But it changes the click location as it should, but the graphical object itself remains in place. I understand that there is no binding of the object label and the object itself? Or I don't understand something at all...

In general, I figured it out, in the CBmpButtonTransparent class, I opened the m_button object and through its Y_Distance method, just like in Top, I enter a new Y coordinate. Now everything works.

 
Konstantin Karpov:

Before you make a description, please tell me which method changes the position of a graphical object on the chart. The Top(aLocation) method from the CWnd class does not change it. But it changes the click location as it should, but the graphical object itself remains in place. I understand that there is no binding of the object label and the object itself? Or I don't understand something at all...

In general, I figured it out, in the CBmpButtonTransparent class, I opened the m_button object and through its Y_Distance method, just like in Top, I enter a new Y coordinate. Now everything works.

No - that's not the way to do it. I'll find an example and upload it. I experimented with it myself during the contest :)

It's just that the move method doesn't belong to my class - it's implemented in the standard library.

Put the folder with all its contents in Experts.

In the Profit_button file, see lines 139-143 and 155-159.

//Money.Shift(0,-3);
//Button.Shift(x,0);

Money.Move(Money.Left(),Money.Top()-3);
Button.Move(Button.Left()+x,Button.Top());

It works both ways - depending on the purpose.

Before launching the Expert Advisor, expand the window to the full screen :)

Files:
Profit.zip  408 kb
[Deleted]  
Andrey Miguzov:

No, don't do that. I'll find an example and upload it. During the contest I experimented with it myself :)

It's just that the move method doesn't belong to my class - it's implemented in the standard library.

Put the folder with all its contents in Experts.

In the Profit_button file, see lines 139-143 and 155-159.

It works both ways - depending on the purpose.

Before launching the Expert Advisor, expand the window to the full screen :)

oops... :) and this method I had overlooked for some reason, I searched and searched all over the standard library help and as they say I saw a figure :) oops... thanks...
[Deleted]  
Andrey Miguzov:

Expand the window to full screen before launching the Expert Advisor :)

Great example!