how can give function of button ?

 

hi , i have a script with one  button i want when i push it  want execute a function , how  is possible do that  ? 

//+------------------------------------------------------------------+
//|                                                  BUTTONCLICK.mq4 |
//|                                  Copyright 2023, MetaQuotes Ltd. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2023, MetaQuotes Ltd."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict

#include <Gui.mqh>

extern color    BackgColore="clrGray";
extern color    TextColore="clrWhite";
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
      Create_Button(0,                    // chart's ID
                    "Button_Apri",         // button name
                    0,                    // X coordinate
                    90,                   // Y coordinate
                    60,                   // button width
                    20,                   // button height
                    CORNER_LEFT_UPPER,    // chart corner for anchoring
                    "APRI",                // text
                    "Courier New",        // font
                    10,                   // font size
                    TextColore,             // text color
                    BackgColore,              // background color
                    false                 // in the background
                      );
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   ObjectsDeleteAll(0);
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   
  }
//+------------------------------------------------------------------+


GUI.mqh

bool Create_Button(const long              chart_ID,     // chart's ID
                      const string            name,         // button name
                      const int               x,            // X coordinate
                      const int               y,            // Y coordinate
                      const int               width,        // button width
                      const int               height,       // button height
                      const ENUM_BASE_CORNER  corner,       // chart corner for anchoring
                      const string            text,         // text
                      const string            font,         // font
                      const int               font_size,    // font size
                      const color             clr,          // text color
                      const color             back_clr,     // background color
                      const bool              back          // in the background
                      )
  {
//--- reset the error value
   ResetLastError();
//--- create the button
   ObjectCreate(chart_ID,name,OBJ_BUTTON,0,0,0);
   ObjectSetInteger(chart_ID,name,OBJPROP_XDISTANCE,x);
   ObjectSetInteger(chart_ID,name,OBJPROP_YDISTANCE,y);
   ObjectSetInteger(chart_ID,name,OBJPROP_XSIZE,width);
   ObjectSetInteger(chart_ID,name,OBJPROP_YSIZE,height);
   ObjectSetString(chart_ID,name,OBJPROP_TEXT,text);
   ObjectSetString(chart_ID,name,OBJPROP_FONT,font);
   ObjectSetInteger(chart_ID,name,OBJPROP_FONTSIZE,font_size);
   ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr);
   ObjectSetInteger(chart_ID,name,OBJPROP_BGCOLOR,back_clr);
   ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back);
//--- successful execution
   return(true);
  }   
 
faustf: one  button i want when i push it  want execute a function , how  is possible do that  ?
OnChartEvent. Look in the codebase for anything with a button, or my GUI Indicators: Money Manager Graphic Tool - Risk Management - Articles, Library comments - MQL5 programming forum - Page 8 #80 (2022).
 
thanks