<AI-slop removed by moderator>
Thank you for your response...but I've already tried and does not work.
Here below very simple code
//+------------------------------------------------------------------+ //| MOSTRANASCONDI.mq4 | //| LC 2025 | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "LC 2025" #property link "https://www.mql5.com" #property version "1.00" #property strict #include <Controls\Button.mqh> CButton ButtonTest; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- ButtonTest.Create(0,"Close",0,20,42,100,60); ButtonTest.Text ("Test Close"); return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- ButtonTest.Disable(); } //+------------------------------------------------------------------+ //| Tester function | //+------------------------------------------------------------------+ double OnTester() { //--- double ret=0.0; //--- //--- return(ret); } //+------------------------------------------------------------------+ //| ChartEvent function | //+------------------------------------------------------------------+ void OnChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam) { //--- if(id==CHARTEVENT_OBJECT_CLICK) { if (sparam=="Close") {Print("ACTION");} } } //+------------------------------------------------------------------+
ButtonTest is disabled, but I can click it
- 2026.07.27
- www.mql5.com
INV2025 #:
...
Forum on trading, automated trading systems and testing trading strategies
When you post code please use the CODE button (Alt-S)!

Thank you.
There's no "disable" implementation for CButton, but you can create your own.
First, set it to Disabled (as you were doing).
When the button's clicked, check if it's disabled (the IS_ENABLED macro should return false) and exit the function block if so
if(!IS_ENABLED) return;
You can also apply visual styling to the button to indicate it's disabled and reset the state to false every time it's clicked.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Dear Community,
I've read all Doc about CButton and it seems to me, there is non built in method to perform following task
1) create CButton
2) CButton should be visible but not clickable at the beginning.
Any idea, how to perform this?