Скачать MetaTrader 5
Авторизуйтесь или зарегистрируйтесь, чтобы добавить комментарий
MQL5 Cloud Network ускоряет расчеты. Попробуй сам!
Evgeny Potapov
1628
Evgeny Potapov 2016.04.04 14:26 

Я пытаюсь научиться пользоваться классами для создания панели, но не могу пока до конца понять как они работают.

Почему данный код не выводит контейнер на график?

//+------------------------------------------------------------------+
//|                                                     MyButton.mq4 |
//|                                   Copyright 2016, Eugene Potapov |
//|                                                    Eugene7@ya,ru |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, Eugene Potapov"
#property link      "Eugene7@ya,ru"
#property version   "1.00"
#property strict
#include <Controls\Button.mqh>
#include <MyControls\MyWndContainer.mqh>

CButton *MyButton;
CWndContainer  *MyContainer;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()  {
   MyButton = new CButton;
   if(CheckPointer(MyButton) == POINTER_INVALID) return(INIT_FAILED);

   MyContainer = new MyWndContainer("MyContainer");
   if(CheckPointer(MyContainer) == POINTER_INVALID) return(INIT_FAILED);
   MyContainer.Add(MyButton);
   MyContainer.Show();
   // MyButton.Create(ChartID(),WindowExpertName()+"_button",0,50,100,150,250);

   
   return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)  {
   if(CheckPointer(MyContainer) != POINTER_INVALID) MyContainer.Destroy();
   if(CheckPointer(MyButton) != POINTER_INVALID) MyButton.Destroy();
   if(CheckPointer(MyContainer) != POINTER_INVALID) delete MyContainer;
   if(CheckPointer(MyButton) != POINTER_INVALID) delete MyButton;
}
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()  {
}
//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)  {
}
//+------------------------------------------------------------------+

Содержимое 
MyControls\MyWndContainer.mqh

//+------------------------------------------------------------------+
//|                                               MyWndContainer.mqh |
//|                                   Copyright 2016, Eugene Potapov |
//|                                                    Eugene7@ya,ru |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, Eugene Potapov"
#property link      "Eugene7@ya,ru"
#property strict
#include <Controls\WndContainer.mqh>

class MyWndContainer : public CWndContainer  {
   public:
      MyWndContainer(string name);
};

//+------------------------------------------------------------------+
//| Constructor                                                      |
//+------------------------------------------------------------------+
MyWndContainer::MyWndContainer(string name) {
   m_chart_id = ChartID();
   m_subwin = 0;
   m_name = name;
                   m_id = 0;
                   m_align_top = true;
                   m_align_right = true;
   /*                
   m_state_flags(WND_STATE_FLAG_ENABLE+WND_STATE_FLAG_VISIBLE),
                   m_prop_flags(0),
                   m_align_flags(WND_ALIGN_NONE),
                   m_align_left(0),
                   m_align_bottom(0),
                   m_mouse_x(0),
                   m_mouse_y(0),
                   m_mouse_flags(MOUSE_INVALID_FLAGS),
                   m_last_click(0),
                   m_drag_object(NULL)
                   */
}
/
Авторизуйтесь или зарегистрируйтесь, чтобы добавить комментарий