Hello coders;
please help me in this expert code ....when i push buy button Dialog1 window close but why when i push sell Button Dialog2 window does not close ?
#property copyright "Copyright 2022, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" #property strict #include <Controls/Dialog.mqh> #include <Controls/Button.mqh> CAppDialog MyInterface; CDialog Dialog1; CDialog Dialog2; CButton Button1; CButton Button2; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { MyInterface.Create(0,"MyInterface",0,20,25,500,300); Button1.Create(0,"Buy",0,50,20,120,80); Button2.Create(0,"Sell",0,350,80,420,20); Button1.Text("Buy"); Button2.Text("Sell"); MyInterface.Add(Button1); MyInterface.Add(Button2); Dialog1.Create(0,"Dialog1",0,0,0,200,100); Dialog2.Create(0,"Dialog2",0,205,0,350,120); MyInterface.Add(Dialog1); MyInterface.Add(Dialog2); MyInterface.Run(); return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { MyInterface.Destroy(reason); } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- } //+------------------------------------------------------------------+ //| ChartEvent function | //+------------------------------------------------------------------+ void OnChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam) { MyInterface.OnEvent(id,lparam,dparam,sparam); if(id==CHARTEVENT_OBJECT_CLICK && sparam=="Buy") Dialog1.Show(); if(id==CHARTEVENT_OBJECT_CLICK && sparam=="Sell") Dialog2.Show(); } //+------------------------------------------------------------------+
Code:
//+------------------------------------------------------------------+ //| ProjectName | //| Copyright 2020, CompanyName | //| http://www.companyname.net | //+------------------------------------------------------------------+ #property copyright "Copyright 2022, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" #property strict #include <Controls/Dialog.mqh> #include <Controls/Button.mqh> CAppDialog MyInterface; CDialog Dialog1; CDialog Dialog2; CButton Button1; CButton Button2; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { MyInterface.Create(0,"MyInterface",0,20,25,500,300); Button1.Create(0,"Buy",0,50,20,120,80); Button2.Create(0,"Sell",0,350,80,420,20); Button1.Text("Buy"); Button2.Text("Sell"); MyInterface.Add(Button1); MyInterface.Add(Button2); Dialog1.Create(0,"Dialog1",0,155,0,250,100); Dialog2.Create(0,"Dialog2",0,255,0,350,100); MyInterface.Add(Dialog1); MyInterface.Add(Dialog2); MyInterface.Run(); //--- Button1.Locking(false); Button1.Locking(false); Dialog1.Visible(false); Dialog2.Visible(false); return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { MyInterface.Destroy(reason); } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- } //+------------------------------------------------------------------+ //| ChartEvent function | //+------------------------------------------------------------------+ void OnChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam) { MyInterface.OnEvent(id,lparam,dparam,sparam); if(id==CHARTEVENT_OBJECT_CLICK && sparam=="Buy") { bool visible=Dialog1.IsVisible(); Dialog1.Visible(!visible); ChartRedraw(); } if(id==CHARTEVENT_OBJECT_CLICK && sparam=="Sell") { bool visible=Dialog2.IsVisible(); Dialog2.Visible(!visible); ChartRedraw(); } } //+------------------------------------------------------------------+
thank you for support.....
the mql5 version you posted work very nice and perfect but in mql4 version posted the code .......actually button sell still have problem .....
the buy button perfectly work when i push show Dialog1 and another push hide it , but in sell button when i pushed do nothing ....i exactly copied your code post in new expert .
do you think problem come from my mt4 or PC ?
thank you for support.....
the mql5 version you posted work very nice and perfect but in mql4 version posted the code .......actually button sell still have problem .....
the buy button perfectly work when i push show Dialog1 and another push hide it , but in sell button when i pushed do nothing ....i exactly copied your code post in new expert .
do you think problem come from my mt4 ?
You are on the MQL5 forum - that's why you get MQL5 answers. There is ONE SPECIAL section for the old terminal - MQL4 and MetaTrader 4.
You are on the MQL5 forum - that's why you get MQL5 answers. There is ONE SPECIAL section for the old terminal - MQL4 and MetaTrader 4.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I use the GRAPHICAL INTERFACES XI: INTEGRATING THE STANDARD GRAPHICS LIBRARY (BUILD 16) as my origenal model , and try to modify it to my panel that I need.