checkbox un cpanel how is logic ?

 

Hi guys  i  dnot  know if i understund a good logic of a checkbox  in cpanel i want  know  if  when i flag cjeckbox  it must return 1  and  when defalg  it must rerun zero ?

because in my sript return always zero

paneldialog.mqh

//+------------------------------------------------------------------+
//|                        PanelDialog.mqh                          |
//|             Copyright 2000-2024, MetaQuotes Ltd.                |
//|                     https://www.mql5.com                        |
//+------------------------------------------------------------------+
#include <Controls\Dialog.mqh>
#include <Controls\Button.mqh>
#include <Controls\Edit.mqh>
#include <Controls\ListView.mqh>
#include <Controls\ComboBox.mqh>
#include <Controls\SpinEdit.mqh>
#include <Controls\RadioGroup.mqh>
#include <Controls\CheckGroup.mqh>

//+------------------------------------------------------------------+
//| defines                                                          |
//+------------------------------------------------------------------+
#define INDENT_LEFT                         (11)      
#define INDENT_TOP                          (11)      
#define INDENT_RIGHT                        (11)      
#define INDENT_BOTTOM                       (11)      
#define CONTROLS_GAP_X                      (10)      
#define CONTROLS_GAP_Y                      (10)      
#define BUTTON_WIDTH                        (100)     
#define BUTTON_HEIGHT                       (20)      
#define EDIT_HEIGHT                         (20)      

//+------------------------------------------------------------------+
//| Class CPanelDialog                                               |
//+------------------------------------------------------------------+
class CPanelDialog : public CAppDialog
{
private:
   CEdit             m_edit;
   CButton           m_button1;
   CButton           m_button2;
   CButton           m_button3;
   CListView         m_list_view;
   CCheckBox         m_checkGroupBreakevenALL;  // Nuovo nome
   CButton           m_buttonBREAKEVEN_Snipe;
public:
   CPanelDialog(void);
   ~CPanelDialog(void);

   virtual bool Create(const long chart,const string name,const int subwin,const int x1,const int y1,const int x2,const int y2);
   virtual bool OnEvent(const int id,const long &lparam,const double &dparam,const string &sparam);

protected:
   bool CreateEdit(void);
   bool CreateButton1(void);
   bool CreateButton2(void);
   bool CreateCheckGroupBreakevenALL(void);  // Nuovo nome
     bool              CReateButtonBREAKEVEN_Snipe(void);
     
   virtual bool OnResize(void);
   void OnClickButton1(void);
   void OnClickButton2(void);
   void OnClickButton3(void);
   bool OnChangeCheckGroupBreakevenALL(void);
   void OnChangeListView(void);
      void              OnClickButtonBREAKEVEN_Snipe(void);   
};

//+------------------------------------------------------------------+
//| Event Handling                                                   |
//+------------------------------------------------------------------+
EVENT_MAP_BEGIN(CPanelDialog)
   ON_EVENT(ON_CLICK, m_button1, OnClickButton1)
   ON_EVENT(ON_CLICK, m_button2, OnClickButton2)
   ON_EVENT(ON_CLICK, m_button3, OnClickButton3)
   ON_EVENT(ON_CHANGE, m_checkGroupBreakevenALL, OnChangeCheckGroupBreakevenALL) // Aggiornato con il nuovo nome
   ON_EVENT(ON_CHANGE, m_list_view, OnChangeListView)
   ON_EVENT(ON_CLICK, m_buttonBREAKEVEN_Snipe, OnClickButtonBREAKEVEN_Snipe)

       
EVENT_MAP_END(CAppDialog)

//+------------------------------------------------------------------+
//| Constructor & Destructor                                         |
//+------------------------------------------------------------------+
CPanelDialog::CPanelDialog(void) { }
CPanelDialog::~CPanelDialog(void) { }

//+------------------------------------------------------------------+
//| Create                                                           |
//+------------------------------------------------------------------+
bool CPanelDialog::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))
      return false;

   if (!CreateEdit()) return false;
   if (!CreateButton1()) return false;
   if (!CreateButton2()) return false;
   if (!CreateCheckGroupBreakevenALL()) return false;  // Aggiornato con il nuovo nome
  if(!CReateButtonBREAKEVEN_Snipe())     return(false);
     
   return true;
}

//+------------------------------------------------------------------+
//| Create the display field                                         |
//+------------------------------------------------------------------+
bool CPanelDialog::CreateEdit(void)
{
   int x1 = INDENT_LEFT;
   int y1 = INDENT_TOP;
   int x2 = ClientAreaWidth() - (INDENT_RIGHT + BUTTON_WIDTH + CONTROLS_GAP_X);
   int y2 = y1 + EDIT_HEIGHT;

   if (!m_edit.Create(m_chart_id, m_name + "Edit", m_subwin, x1, y1, x2, y2))
      return false;
   if (!m_edit.ReadOnly(true))
      return false;
   if (!Add(m_edit))
      return false;

   m_edit.Alignment(WND_ALIGN_WIDTH, INDENT_LEFT, 0, INDENT_RIGHT + BUTTON_WIDTH + CONTROLS_GAP_X, 0);
   return true;
}

//+------------------------------------------------------------------+
//| Create Buttons                                                   |
//+------------------------------------------------------------------+
bool CPanelDialog::CreateButton1(void)
{
   int x1 = ClientAreaWidth() - (INDENT_RIGHT + BUTTON_WIDTH);
   int y1 = INDENT_TOP;
   int x2 = x1 + BUTTON_WIDTH;
   int y2 = y1 + BUTTON_HEIGHT;

   if (!m_button1.Create(m_chart_id, m_name + "Button1", m_subwin, x1, y1, x2, y2))
      return false;
   if (!m_button1.Text("Button1"))
      return false;
   if (!Add(m_button1))
      return false;

   return true;
}

//+------------------------------------------------------------------+
//| Create Button2                                                   |
//+------------------------------------------------------------------+
bool CPanelDialog::CreateButton2(void)
{
   int x1 = ClientAreaWidth() - (INDENT_RIGHT + BUTTON_WIDTH);
   int y1 = INDENT_TOP + BUTTON_HEIGHT + CONTROLS_GAP_Y;
   int x2 = x1 + BUTTON_WIDTH;
   int y2 = y1 + BUTTON_HEIGHT;

   if (!m_button2.Create(m_chart_id, m_name + "Button2", m_subwin, x1, y1, x2, y2))
      return false;
   if (!m_button2.Text("Button2"))
      return false;
   if (!Add(m_button2))
      return false;

   return true;
}

//+------------------------------------------------------------------+
//| Create the CheckGroupBreakevenALL                                |
//+------------------------------------------------------------------+
bool CPanelDialog::CreateCheckGroupBreakevenALL(void)
{
   int x1 = 1396;  
   int y1 = 41;    
   int x2 = 1496;  
   int y2 = 61;    

   // Creazione del gruppo di checkbox
   if (!m_checkGroupBreakevenALL.Create(m_chart_id, m_name + "CheckGroupBreakevenALL", m_subwin, x1, y1, x2, y2))
      return false;

   if (!m_checkGroupBreakevenALL.Text("All Trade"))
      return false;

   if (!Add(m_checkGroupBreakevenALL))
      return false;

   return true;
}


    
//+------------------------------------------------------------------+
//| Create the "ButtonBREAKEVEN_Snipe" button                        |
//+------------------------------------------------------------------+
bool CPanelDialog::CReateButtonBREAKEVEN_Snipe(void)
  {
//--- coordinates
 //int sx=(ClientAreaWidth()-(INDENT_LEFT+INDENT_RIGHT+BUTTON_WIDTH))/3-CONTROLS_GAP_X;
   int x1 = 2396;  
   int y1 = 41;    
   int x2 = 2496;  
   int y2 = 61;  
//--- create
   if(!m_buttonBREAKEVEN_Snipe.Create(m_chart_id,m_name+"ButtonBREAKEVEN_Snipe",m_subwin,x1,y1,x2,y2))
      return(false);
   if(!m_buttonBREAKEVEN_Snipe.Text("BREAKEVEN SNIPE"))
      return(false);
   if(!Add(m_buttonBREAKEVEN_Snipe))
      return(false);
   m_buttonBREAKEVEN_Snipe.Alignment(WND_ALIGN_RIGHT,0,0,INDENT_RIGHT,0);
//--- succeed
   return(true);
  }        
 
//+------------------------------------------------------------------+
//| OnResize                                                         |
//+------------------------------------------------------------------+
bool CPanelDialog::OnResize(void)
{
   if (!CAppDialog::OnResize()) return false;

   int x = ClientAreaLeft() + INDENT_LEFT;
   int sx = (ClientAreaWidth() - (INDENT_LEFT + INDENT_RIGHT + BUTTON_WIDTH)) / 3 - CONTROLS_GAP_X;

   return true;
}

//+------------------------------------------------------------------+
//| Event Handlers                                                   |
//+------------------------------------------------------------------+

  void CPanelDialog::OnClickButtonBREAKEVEN_Snipe(void)
  {

        Print ("BOTTONE BREAK EVEN 8772818");
        }
void CPanelDialog::OnClickButton1(void)
{
   m_edit.Text(__FUNCTION__);
}

void CPanelDialog::OnClickButton2(void)
{
   m_edit.Text(__FUNCTION__);
}

void CPanelDialog::OnClickButton3(void)
{
   if (m_button3.Pressed())
      m_edit.Text(__FUNCTION__ + "On");
   else
      m_edit.Text(__FUNCTION__ + "Off");
}

//+------------------------------------------------------------------+
//| OnChangeCheckGroupBreakevenALL                                   |
//+------------------------------------------------------------------+
bool CPanelDialog::OnChangeCheckGroupBreakevenALL(void)
{
   Print("OnChangeCheckGroupBreakevenALL triggered");
   Print("Valore checkbox: " + IntegerToString(m_checkGroupBreakevenALL.Value()));
   return true;  
}

void CPanelDialog::OnChangeListView(void)
{
   m_edit.Text(__FUNCTION__ + " \"" + m_list_view.Select() + "\"");
}

simplepanel.mq5

//+------------------------------------------------------------------+
//|                                                  SimplePanel.mq5 |
//|                             Copyright 2000-2024, MetaQuotes Ltd. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2000-2024, MetaQuotes Ltd."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property indicator_separate_window
#property indicator_plots               0
#property indicator_buffers             0
#property indicator_minimum             0.0
#property indicator_maximum             0.0
#include "PanelDialog.mqh"
//+------------------------------------------------------------------+
//| Global Variables                                                 |
//+------------------------------------------------------------------+
CPanelDialog ExtDialog;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit(void)
  {
//--- create application dialog
   if(!ExtDialog.Create(0,"Simple Panel",0,50,50,390,200))
     return(INIT_FAILED);
//--- run application
   if(!ExtDialog.Run())
     return(INIT_FAILED);
//--- succeed
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//--- destroy application dialog
   ExtDialog.Destroy(reason);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const int begin,
                const double &price[])
  {
//---
   
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
   ExtDialog.ChartEvent(id,lparam,dparam,sparam);
  }
//+------------------------------------------------------------------+