CPanel does not Show Text

 

This code will display the AppDialog and Panel.

The Panel color shows as LightGray, but I cannot make the Text appear.

This may be a simple example but I cannot make it work. Any ideas?

Thanks for the help.


#property strict
#property indicator_chart_window

#include <Controls\Dialog.mqh>
CAppDialog MyAppDialog;
CPanel     MyPanel;
//--------------------------------------------------------------------
int OnInit()
  {
    MyAppDialog.Create(0,"MyAppDialog",0,10,20,300,300);
    
    MyPanel.Create(0,"MyPanel",0,10,20,100,80);
    MyPanel.ColorBackground(clrLightGray);
    MyPanel.Text("Panel");
    MyPanel.Color(clrBlue);
    MyPanel.Font("Arial Bold");
    MyPanel.FontSize(8);
    
    MyAppDialog.Add(MyPanel);
    MyAppDialog.Run();
    return(INIT_SUCCEEDED);
  }
//--------------------------------------------------------------------
void OnDeinit(const int reason)
  {
   MyAppDialog.Destroy(reason);
  }
//--------------------------------------------------------------------
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
   return(rates_total);  //return value of prev_calculated for next call
  }
//--------------------------------------------------------------------
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
     MyAppDialog.OnEvent(id,lparam,dparam,sparam);
  }


 
#include <Controls\Dialog.mqh>
#include <Controls\Label.mqh>
CAppDialog MyAppDialog;
CPanel     MyPanel;
CLabel     MyLabel;
//--------------------------------------------------------------------
int OnInit()
  {
    MyAppDialog.Create(0,"MyAppDialog",0,10,20,300,300);
    
    MyPanel.Create(0,"MyPanel",0,10,20,100,80);
    MyPanel.ColorBackground(clrLightGray);
    /*MyPanel.Text("Panel");
    MyPanel.Color(clrBlue);
    MyPanel.Font("Arial Bold");
    MyPanel.FontSize(8);*/

    MyLabel.Create(0, "Label-1", 0, 30, 40, 0, 0);
    MyLabel.Text("Panel");
    MyLabel.Color(clrBlue);
    MyLabel.Font("Arial Bold");
    MyLabel.FontSize(8);
    MyAppDialog.Add(MyLabel);
    
    MyAppDialog.Add(MyPanel);
    MyAppDialog.Run();
    return(INIT_SUCCEEDED);
  }
 
Nagisa Unada:

Why do I have to add another class object.

The CPanel class already includes a Text method.

If I type "MyPanel." with the period MetaEditor will list all related methods and Text is there.

Reason: