This article describes a safe way to handle the deletion of graphical objects: event interception, object recreation, and restoration of a minimal set of properties. We'll show you how to avoid errors when working with pointers, prevent unwanted object recreation during shutdown, and preserve object positions and dimensions by updating them using DRAG/CHANGE. As a result, the indicator remains intact, and the user retains some of their settings.
In the previous article, “From Basic to Intermediate: Objects and Subwindows (II)”, we looked at the simplest and most practical way to handle a situation where an object placed on the chart by our code has been deleted—whether intentionally or as a result of an operator or user error. However, this approach may ultimately lead to dissatisfaction among some users. In their view, deleting an object from the chart should not result in the entire application being removed.
Since there is another way to handle the accidental deletion of objects—such as when a user deletes something without realizing how important it really is—I decided to devote a separate article to this topic. Here, we'll look at how to restore an object that was accidentally deleted from the chart. The goal is to show how this can be done. In addition, the concepts we have discussed can also be applied to other similar situations. So, let's move on to what we're interested in.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Check out the new article: From Basic to Intermediate: Objects and Subwindows (III).
In the previous article, “From Basic to Intermediate: Objects and Subwindows (II)”, we looked at the simplest and most practical way to handle a situation where an object placed on the chart by our code has been deleted—whether intentionally or as a result of an operator or user error. However, this approach may ultimately lead to dissatisfaction among some users. In their view, deleting an object from the chart should not result in the entire application being removed.
Since there is another way to handle the accidental deletion of objects—such as when a user deletes something without realizing how important it really is—I decided to devote a separate article to this topic. Here, we'll look at how to restore an object that was accidentally deleted from the chart. The goal is to show how this can be done. In addition, the concepts we have discussed can also be applied to other similar situations. So, let's move on to what we're interested in.
Author: CODE X