How to set ListView, checkgroup and radiogroup? - page 2

To add comments, please log in or register
Jiayu Fu
1576
Jiayu Fu  
Filter:
Yup, all of the examples I've tested in MT4 for the panel classes seems to work out of the box

 the code show button separated and a dialog(panel) but when i delete this part , also the button isnt created, why?

if(!CAppDialog::Create(chart,name,subwin,x1,y1,x2,y2))               //here i tried
      return(false);                                                    //here i tried

-to individual the button i erased until these code:

-if i only want the button on the chart what should i do? 

//+------------------------------------------------------------------+
//|                                                     Controls.mq5 |  Controls.mq5
//|                   Copyright 2009-2013, MetaQuotes Software Corp. |
//+------------------------------------------------------------------+
#include "ControlsDialog.mqh"
CControlsDialog ExtDialog;
//+----------------Expert chart event function------------------------+
void OnChartEvent(const int id,         // event ID  
                  const long& lparam,   // event parameter of the long type
                  const double& dparam, // event parameter of the double type
                  const string& sparam) // event parameter of the string type
  {
   ExtDialog.ChartEvent(id,lparam,dparam,sparam);
  }
//+------------------Expert initialization function-------------------+
int OnInit()
  {
   if(!ExtDialog.Create(0,"Controls",0,10,10,360,224)) return(INIT_FAILED);  
   return(INIT_SUCCEEDED);
  }
//+------------------Expert deinitialization function   -------------+
void OnDeinit(const int reason) { ExtDialog.Destroy(reason); }
//+------------------------------------------------------------------+
//|                                               ControlsDialog.mqh |
//|                   Copyright 2009-2013, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+

//controlsdialog.mqh

#include <Controls\Dialog.mqh>
#include <Controls\Button.mqh>
//+------------------------------------------------------------------+
class CControlsDialog : public CAppDialog
  {
private:
   CButton           m_button1;                       // the button object
public:
                     CControlsDialog(void){}
                    ~CControlsDialog(void){}
   //--- create
   virtual bool      Create(const long chart,const string name,const int subwin,const int x1,const int y1,const int x2,const int y2);

  };
//+------------------------------------------------------------------+
bool CControlsDialog::Create(const long chart,const string name,const int subwin,const int x1,const int y1,const int x2,const int y2)
  {
   if(!CAppDialog::Create(chart,name,subwin,x1,y1,x2,y2))               //here i tried
      return(false);                                                    //here i tried
      
   m_button1.Create(m_chart_id,m_name+"Button1",m_subwin,11,16,111,36);
   m_button1.Text("Button1");
   Add(m_button1);
//--- succeed
   return(true);
  }
//+------------------------------------------------------------------+
Vladimir Karputov
Moderator
189912
Vladimir Karputov  
Aeither :

 the code show button separated and a dialog(panel) but when i delete this part , also the button isnt created, why?

-to individual the button i erased until these code:

-if i only want the button on the chart what should i do? 

If you want to create a button, without dialog(panel), here's an example: OBJ_BUTTON
Jiayu Fu
1576
Jiayu Fu  
barabashkakvn:
If you want to create a button, without dialog(panel), here's an example: OBJ_BUTTON
ok thanks
12
To add comments, please log in or register