Deleting CButton from CAppDialog New comment Ziv Shmuel Ben Yaacov 2022.08.30 05:49 Hi, After creating an object CButton on a chart, to delete it from the chart I am using the Destroy function. CButton Button_1; Button_1 .Create(0, " Button_1 ", 0, 0, 0, 0, 0); Button_1 .Destroy(); However, when creating an object CButton and adding it to CAppDialog, for some reason the Destroy function does not delete it from the chart: // adding CButton to CAppDialog CAppDialog appDialog; appDialog.Create(0, "appDialog", 0, 0, 0, 0 , 0); CButton Button_2; Button_2.Create(0, "Button_2", 0, 0, 0, 0, 0); appDialog.Add(Button_2); // trying to remove CButton from CAppDialog appDialog.Delete(Button_2); Button_2.Destroy(); I also tried: // trying to remove CButton from CAppDialog Button_2.Destroy(); appDialog.Delete(Button_2); But this also did not succeeded to delete the button. I found that inorder to delete the button from CAppDialog I have to use the ObjectDelete function: // adding CButton to CAppDialog CAppDialog appDialog; appDialog.Create(0, "appDialog", 0, 0, 0, 0 , 0); CButton Button_3; Button_3.Create(0, "Button_3", 0, 0, 0, 0, 0); appDialog.Add(Button_3); // removing successfully CButton from CAppDialog/chart Button_3.Destroy(); ObjectDelete(0,"Button_3"); Does anybody know if there is other way/function to delete the button from CAppDialog/chart? Documentation on MQL5: Object Functions / ObjectDelete www.mql5.com ObjectDelete - Object Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5 New comment
Hi,
After creating an object CButton on a chart, to delete it from the chart I am using the Destroy function.
However, when creating an object CButton and adding it to CAppDialog, for some reason the Destroy function does not delete it from the chart:
I also tried:
// trying to remove CButton from CAppDialog Button_2.Destroy(); appDialog.Delete(Button_2);But this also did not succeeded to delete the button.
I found that inorder to delete the button from CAppDialog I have to use the ObjectDelete function:
Does anybody know if there is other way/function to delete the button from CAppDialog/chart?