Support Board
Date/Time: Sun, 06 Jul 2025 14:38:11 +0000
[Programming Help] - Unable to delete drawing placed on different chart
View Count: 1015
[2019-03-22 22:16:29] |
maxpi - Posts: 185 |
I copied some example code and made a study. When I set TextDrawing.ChartNumber = 1 it draws the text and erases it at the LastCallToFunction. When I set TextDrawing.ChartNumber = 2 it draws the text on chart#2 but does not erase it at LastCallToFunction. #include "sierrachart.h" SCDLLName("Custom Study DLL") SCSFExport scsf_DrawingToChart2TestStudy(SCStudyInterfaceRef sc) { // Set configuration variables if (sc.SetDefaults) { sc.GraphName = "User Drawn Text"; sc.StudyDescription = "User drawn text drawing test86."; sc.GraphRegion = 0; sc.AutoLoop = 0; //No automatic looping return; } int &TextDrawingLineNumber = sc.GetPersistentInt(1); if (sc.LastCallToFunction) { if (TextDrawingLineNumber != 0) { // Be sure to remove the Text drawing added as a user drawn drawing sc.DeleteUserDrawnACSDrawing(sc.ChartNumber, TextDrawingLineNumber); } return; } int BarIndex = sc.ArraySize - 20; if (BarIndex < 0) return; s_UseTool TextDrawing; TextDrawing.Clear();//Not necessary but good practice TextDrawing.ChartNumber = 1; TextDrawing.DrawingType = DRAWING_TEXT; if(TextDrawingLineNumber != 0) TextDrawing.LineNumber = TextDrawingLineNumber; TextDrawing.AddAsUserDrawnDrawing = 1; TextDrawing.BeginIndex = BarIndex; TextDrawing.BeginValue = sc.High[BarIndex]; TextDrawing.Color = COLOR_KHAKI; TextDrawing.Text = "Movable User Drawn Text Example"; TextDrawing.FontSize = 18; // do not keep adjusting TextDrawing.AddMethod = UTAM_ADD_ONLY_IF_NEW; sc.UseTool(TextDrawing); //Remember the line number which has been automatically assigned TextDrawingLineNumber = TextDrawing.LineNumber; } |
To post a message in this thread, you need to log in with your Sierra Chart account: