CAppPanel: Why doesn't Destroy() with reason > 0 not delete the panel?

 

I'm writing a dashboard that displays information from symbols across all other open charts.

If a chart is deleted or added, I need to resize the dashboard and remove/add the missing symbol/timeframes.

Rather than coding a resize, I figured it's better to just delete the panel and re-create it. However, calling Destroy() doesn't delete the panel on the chart.

I've checked the return value of OnDestroy() (true) and checked _LastError (0), so I don't know what's going on. The only difference I've seen between Destroy() with a value of 0 (REASON_REMOVE) and a value greater than 0 is that ChartIndicatorDelete() will get called when reason == REASON_REMOVE. Even then, I don't see how that would allow for the objects to be deleted.

BTW, I've worked around the issue by manually deleting the objects using ObjectsDeleteAll (for anyone looking to do the same: you also need to re-initialize the CAppDialog variable), but it irks me that the panel isn't deleted automatically when calling Destroy().

Thanks.

Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Uninitialization Reason Codes
Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Uninitialization Reason Codes
  • www.mql5.com
Uninitialization Reason Codes - Named Constants - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Alexander Martinez:

I'm writing a dashboard that displays information from symbols across all other open charts.

If a chart is deleted or added, I need to resize the dashboard and remove/add the missing symbol/timeframes.

Rather than coding a resize, I figured it's better to just delete the panel and re-create it. However, calling Destroy() doesn't delete the panel on the chart.

I've checked the return value of OnDestroy() (true) and checked _LastError (0), so I don't know what's going on. The only difference I've seen between Destroy() with a value of 0 (REASON_REMOVE) and a value greater than 0 is that ChartIndicatorDelete() will get called when reason == REASON_REMOVE. Even then, I don't see how that would allow for the objects to be deleted.

BTW, I've worked around the issue by manually deleting the objects using ObjectsDeleteAll (for anyone looking to do the same: you also need to re-initialize the CAppDialog variable), but it irks me that the panel isn't deleted automatically when calling Destroy().

Thanks.

Just gonna chalk this up to a bug since I'm not getting any replies.