Support Board
Date/Time: Fri, 29 Nov 2024 02:51:36 +0000
[Programming Help] - ACSIL: sc.DeleteUserDrawnACSDrawing() does not delete all drawings
View Count: 502
[2023-03-09 16:03:13] |
User907967 - Posts: 54 |
Dear support team, I wrote a function that should delete all user drawings from the chart. I am calling this function when the user hides the study and also when the user removes the study. In the case of the former, all drawings are successfully removed from the chart. In the latter's case, a few user drawings always remain on the chart. The function that removes all drawings: s_UseTool Tool;
Tool.Clear(); int DrawingIndex = 0; while (sc.GetUserDrawnChartDrawing(sc.ChartNumber, DRAWING_RECTANGLE_EXT_HIGHLIGHT, Tool, DrawingIndex)){ sc.DeleteUserDrawnACSDrawing(sc.ChartNumber, Tool.LineNumber); DrawingIndex++; } The events where I am calling the above function: if (sc.LastCallToFunction) if (sc.HideStudy) Why is the above while-loop not sufficient when using sc.DeleteUserDrawnACSDrawing, to get rid of all shapes? |
[2023-03-09 17:07:41] |
User907967 - Posts: 54 |
To add to the question -- is there a better way to loop through all existing user drawings than the one above? For the non-user drawings, there is an easier way given sc.GetACSDrawingsCount(). However, without such a function, I am looking for better ways to loop through all the user drawings. |
[2023-03-09 17:08:33] |
User431178 - Posts: 544 |
Why is the above while-loop not sufficient when using sc.DeleteUserDrawnACSDrawing, to get rid of all shapes?
When you delete a drawing what happens to the index of the subsequent drawings...? Remove the DrawingIndex++ and try again. |
[2023-03-09 17:10:50] |
User431178 - Posts: 544 |
For the non-user drawings, there is an easier way given sc.GetACSDrawingsCount()
Equivalent function for user drawn drawings: sc.GetUserDrawnDrawingsCount (Added at version 2380) |
[2023-03-09 18:05:40] |
User907967 - Posts: 54 |
Thank you so much for the correction and the reference to the new method, User431178.
|
To post a message in this thread, you need to log in with your Sierra Chart account: