Daialog and Button, Need Help.

 

i create dialog and button UI, But cant Action after Click On Test Button BT10.
Cant Print "Button Pressed"

NewProject.mq5



#include <Trade\Trade.mqh>
#include <GraphicalPanel.mqh>

CTrade trade;
CGraphicalPanel panel;

int OnInit() {
      if(!panel.Oninit()){return INIT_FAILED;}
   	return(INIT_SUCCEEDED);
}


void OnDeinit(const int reason){
   panel.Destroy(reason);
   }


void OnTick(){


}


void OnChartEvent(
   const int      id,
   const long&    lparam,
   const double&  dparam,
   const string&  sparam
   ){
   
   panel.ChartEvent(id,lparam,dparam,sparam);
   
   
  }


NewProject.mqh



//#include <Trade\Trade.mqh>
#include <Controls\Dialog.mqh>
#include <Controls\Label.mqh>
#include <Controls\Button.mqh>
long testtex;

input string   x1text = btn1text;
input string   x2text = btn2text;




input group "=== Panel Inputs===";

static input color InpPanelTxtColor = clrWhite;
static input color Btn1clr = clrOrangeRed;
static input color Btn2clr = clrOrange;
static input color BtnBEclr = clrBlue;
static input color BtnCloseclr = clrRed;
#define ROW_HEIGHT 40
#define BTN_WIDTH 90


#define PANEL_WIDTH 100
#define PANEL_HEIGHT 400








class CGraphicalPanel : public CAppDialog
{

   private:
   
      CLabel LB1;
      CButton BTN1;
      CButton BTN2;
      
      CButton BTN9;
      CButton BTN10;
   
   
      //void OnClickButton10();
      bool CreatePanel();
         
   public:
      
      
      void CGraphicalPanel();
      void ~CGraphicalPanel();
      bool Oninit();
      
      
      ///cheart event
      void PanelChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam);


};


void CGraphicalPanel::CGraphicalPanel(void){}
void CGraphicalPanel::~CGraphicalPanel(void){}


bool CGraphicalPanel::Oninit(void){
   if(!this.CreatePanel()) {return false;}
   
   return true;

}


bool CGraphicalPanel::CreatePanel(void){
   
   this.Create(NULL,"NP v1",0,0,25,PANEL_WIDTH+8,PANEL_HEIGHT);
   
   
   BTN1.Create(NULL,"BTN1N",0,0,0,0,0);
   BTN1.Width(PANEL_WIDTH);
   BTN1.Height(ROW_HEIGHT);
   BTN1.ColorBackground(Btn1clr);
   BTN1.Text("BT1");
   BTN1.Color(clrWhite);
   //BTN1.FontSize(14);
   this.Add(BTN1);
   
   BTN2.Create(NULL,"BTN2N",0,0,45,0,0);
   BTN2.Width(PANEL_WIDTH);
   BTN2.Height(ROW_HEIGHT);
   BTN2.ColorBackground(Btn2clr);
   BTN2.Text("BT2");
   BTN2.Color(clrWhite);
   //BTN1.FontSize(14);
   this.Add(BTN2);
   
   
   
   
   BTN9.Create(NULL,"BTN9N",0,0,120,0,0);
   BTN9.Width(PANEL_WIDTH);
   BTN9.Height(ROW_HEIGHT);
   BTN9.ColorBackground(BtnBEclr);
   BTN9.Text("BT9");
   BTN9.Color(clrWhite);
   //BTN1.FontSize(14);
   this.Add(BTN9);
   
   
   BTN10.Create(NULL,"BTN10N",0,0,165,0,0);
   BTN10.Width(PANEL_WIDTH);
   BTN10.Height(ROW_HEIGHT);
   BTN10.ColorBackground(BtnCloseclr);
   BTN10.Text("BT10");
   BTN10.Color(clrWhite);
   //BTN1.FontSize(14);
   this.Add(BTN10);
   
   /////////////////////////////////////
   
   
   LB1.Create(0,"text1 ",0,5,90,0,0);
   LB1.Text("test text ");
   this.Add(LB1);
   
   
   
   
   
   if(!Run()){Print("Failed to run panel"); return false;}
   
   
   ChartRedraw();
   return true;

}

void CGraphicalPanel::PanelChartEvent(const int id,const long &lparam,const double &dparam,const string &sparam){
   ChartEvent(id,lparam,dparam,sparam);
   
   
   
   //check botton
   //if(id==CHARTEVENT_OBJECT_CLICK && sparam=="BTN10N"){ 
   //}
   if(id==CHARTEVENT_OBJECT_CLICK){   
   
      if(sparam == "BTN10N"){
      //OnClickButton10();
      Print("Button 10 Pressed");
        
      }
   
  }
   
   
    
   
 }


 
Your topic has been moved to the section: Expert Advisors and Automated Trading
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893