label with background color

 

How to achieve this please ?

 

CChartObjectEdit - not suitable as you can't disable it

CChartObjectButton -  not suitable as you can't disable it

Other objects seems not have background or can put text.

Thank you

 
chinaski:

How to achieve this please ?

 

CChartObjectEdit - not suitable as you can't disable it

CChartObjectButton -  not suitable as you can't disable it

Other objects seems not have background or can put text.

Thank you

 

I was thinking about drawing rectangle object before drawing the label, but I think MT5 draws objects according to MT5 own order (alphabetically - if I'm not mistaken). So my suggestion will be useless.

:( 

Documentation on MQL5: Standard Constants, Enumerations and Structures / Objects Constants / Object Types
Documentation on MQL5: Standard Constants, Enumerations and Structures / Objects Constants / Object Types
  • www.mql5.com
Standard Constants, Enumerations and Structures / Objects Constants / Object Types - Documentation on MQL5
 
phi.nuts:

I was thinking about drawing rectangle object before drawing the label, but I think MT5 draws objects according to MT5 own order (alphabetically - if I'm not mistaken). So my suggestion will be useless.

:( 

Create object with OBJ_RECTANGLE_LABEL, and then draw text label on it. 

I think it's in CChartObjectRectLabel class in ChartObjectsTxtControls.mqh.

I never tried that before. Hope that's helps. 

I may help you if you delete your other thread, coz that is double posting asking same topic ;D 

 
phi.nuts:

Create object with OBJ_RECTANGLE_LABEL, and then draw text label on it. 

I think it's in CChartObjectRectLabel class in ChartObjectsTxtControls.mqh.

I never tried that before. Hope that's helps. 

I may help you if you delete your other thread, coz that is double posting asking same topic ;D 

I'll be happy to help, but apparently, you like creating multiple thread asking the same topic, which is not appreciated around here.
 

Sir,

i do not understand why you remove my posts.

One thing is to have a rectangle with label. This seems not to be possible.

The order point is why  

 

 CChartObjectRectLabel .X_Distance is not the same as x value on creation.

If you can't help, allow others to help. Thank you. 

 
chinaski:

Sir,

i do not understand why you remove my posts.

One thing is to have a rectangle with label. This seems not to be possible.

The order point is why  

 

 CChartObjectRectLabel .X_Distance is not the same as x value on creation.

If you can't help, allow others to help. Thank you. 

I deleted your other thread because it can be asked and continued from this thread. I never delete any post that I can not answer, I will let other to answer.

So, can you show the code ?

 

Hello Sir,

can't agree this belongs to same thread. One is about a feature and the other is about geometrics. However, this is the code

CChartObjectRectLabel* pl=new CChartObjectRectLabel;
pl.Create(ChartID(),"xyname",0,100,10,100,100);
/// set X_Distance to 100, so same offset as with creation; this let's lable jump to left
pl.X_Distance(100);

 

 Thank you

 
chinaski:

Hello Sir,

can't agree this belongs to same thread. One is about a feature and the other is about geometrics. However, this is the code

 Thank you

...and it's all about CChartObjectRectLabel  :)

My rectangle does not moves a bit. Are you sure that you write the code correctly ? coz I change the X_Distance to 200 and to 50, and it moves.

Here's your answer

//+------------------------------------------------------------------+
//| Class CChartObjectRectLabel.                                     |
//| Purpose: Class of the "Rectangle Label" object of chart.         |
//|          Derives from class CChartObjectLabel.                   |
//+------------------------------------------------------------------+

 Find X_Distance method in CChartObjectLabel Class, but I have hard time to explain this :(

 
You are right. Sorry. There was some hidden code.
Reason: