Same code compiled well but have difference output in mql5/4

 

Hi,

this code compiled well on both MQL4 and 5. But in mt5 the button will not pressed at all. What should I do to make button work on MT5?

#include <Controls/Dialog.mqh>
#include <Controls/Button.mqh>

CAppDialog pannel;
CButton btn;
int OnInit() {
   pannel.Create(0, "panel", 0, 10, 10, 300, 300);
   btn.Create(0, "btn", 0, 30, 30, 80, 60);
   btn.Text("Click");
   pannel.Add(btn);
   pannel.Run();
   return(INIT_SUCCEEDED);
}
void OnDeinit(const int reason) {
   pannel.Destroy(reason);
}
void OnTick() {
   long pressed = false;
   if(ObjectGetInteger(0, "btn", OBJPROP_STATE, 0, pressed)) {
      if(pressed) {
         printf("YES");
      }

   }
}

mt5 clip that show the how button not work on mt5

https://uupload.ir/view/cbutton_qyf5.mp4/

mt4 clip that show the how button work on mt4

https://uupload.ir/view/cbutton_mql4_0ci.mp4/