Download MetaTrader 5
To add comments, please log in or register
Why to sell products in MetaTrader AppStore? Find that out from the article!
Michael
496
Michael 2016.01.15 05:02 

Note: If this post is duplicated, sorry.  I'm pc crashed while I was doing it.

Isn't an object of this type supposed to support text in it?  My code draws the box just fine.  But no text shows up inside.  I'm pretty sure I'm missing something.  Anyone know?

#property strict
#include <ChartObjects\ChartObjectsTxtControls.mqh>
CChartObjectRectLabel rectLabel;

int OnInit()
  {
   return(INIT_SUCCEEDED);
  }

void OnDeinit(const int reason)
  {

  }

void OnTick()
  {
   rectLabel.Create(0,"rlabel",0,75,75,100,100);
   rectLabel.BackColor(clrBlack);
   rectLabel.Hidden(false);
   rectLabel.SetString(OBJPROP_TEXT,"My Box!");
   rectLabel.Color(clrYellow);
  }
Keith Watford
Moderator
7918
Keith Watford 2016.01.15 06:41  

The name suggests that it would also have text, but it doesn't.

At least I don't know how to display text. I tried at first because I made the same logical assumption as you.

It's just really useful as a panel background and you can place ordinary labels or other objects on top of it 

honest_knave
965
honest_knave 2016.01.15 07:44  

Ordinarily, a rectangle label object doesn't support text (but I've not experimented with it using ChartObjects).

The alternative is to use OBJ_BUTTON. This allows you to set a background color, a border color and text all in one object. 

/
To add comments, please log in or register