CChartObjectRectLabel question

 

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);
  }
 

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 

 

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. 

Reason: