Support Board
Date/Time: Tue, 13 May 2025 16:14:32 +0000
Post From: Problems adjusting ChartDrawing that was added as User Drawn Drawing
[2024-08-28 12:54:23] |
StanThompson94 - Posts: 6 |
Dear Support Team, I was inactive for a long time (about a quarter to half a year) and have now updated Sierra Chart to the current version (2670). A study I implemented back then no longer works as it should. I have attached a simplified version of the code as an image and the code below to reproduce the error: - I add a ChartDrawing and set "AddAsUserDrawnDrawing=1" (Line 42 to 61 in the picture) - If the lines 69 to 74 below "sc.UseTool(Tool1);" are commented out, the tool will be displayed correctly - If I then try to change the color (lines 69 to 74 are not commented out), the chart drawing is no longer visible - However, the tool still needs to exist because in the code the tool can still be accessed via the LineNumber (see lines 78 to 82) I hope you can help me and thank you in advance. s_UseTool Tool1; Tool1.Clear(); Tool1.DrawingType = DRAWING_RECTANGLEHIGHLIGHT; Tool1.BeginDateTime = 0; Tool1.EndDateTime = 150; Tool1.BeginValue = 5600; Tool1.EndValue = 5616; Tool1.Color = COLOR_BLUE; Tool1.LineWidth = 1; //To see the outline this must be 1 or greater. Tool1.SecondaryColor = COLOR_BLUE; Tool1.TransparencyLevel = 75; Tool1.AddMethod = UTAM_ADD_OR_ADJUST; Tool1.ExtendLeft = 1; Tool1.ShowPrice = 1; Tool1.AddAsUserDrawnDrawing = 1; Tool1.TextAlignment = DT_RIGHT; Tool1.ChartNumber = sc.ChartNumber; sc.UseTool(Tool1); //Tool is added correctly and visible if code below is commented out s_UseTool Tool2; sc.GetUserDrawnDrawingByLineNumber(sc.ChartNumber, Tool1.LineNumber, Tool2); //Try to change color from blue to gray if (Tool2.Color != COLOR_GRAY) { Tool2.Color = COLOR_GRAY; Tool2.SecondaryColor = COLOR_GRAY; Tool2.TransparencyLevel = 75; sc.UseTool(Tool2); } //Tool is no more visible, but must be there, because the following code lines provide the values in the comments s_UseTool Tool3; sc.GetUserDrawnDrawingByLineNumber(sc.ChartNumber, Tool2.LineNumber, Tool3); float beginValue = Tool3.BeginValue; //beginValue == 5600 float endValue = Tool3.EndValue; //endValue == 5616 int toolColor = Tool3.Color; //toolColor == COLOR_GRAY |
![]() |