Login Page - Create Account

Support Board


Date/Time: Sat, 04 May 2024 19:24:56 +0000



Post From: bar index of ACSIL created drawing

[2018-07-15 10:40:06]
binaryduke - Posts: 360
We have confirmed that both of those variables are set when getting the drawing.

Please could you provide an example of this that successfully returns BeginIndex or BeginDateTime? Testing with the code below still returns a -1 value for the BeginIndex member of the s_UseTool structure yet the BeginValue member of the structure is populated upon the creation of the drawing. I have noted the documentation comment for sc.GetACSDrawingByIndex() that:


When a Chart Drawing you are getting is not visible in the current view of the chart, then s_UseTool::BeginIndex, s_UseTool::EndIndex, s_UseTool::ThirdIndex will all equal -1 unless the drawing specified its horizontal positioning using these *Index values when it was added.

and in testing the code below specified the horizontal positioning using these Index values. I have further tested by specifying s_UseTool::EndIndex and s_UseTool::ThirdIndex with the same result.


//create a drawing
s_UseTool MyDrawing;
MyDrawing.Clear();
MyDrawing.ChartNumber = sc.ChartNumber;
MyDrawing.DrawingType = DRAWING_MARKER;
MyDrawing.MarkerType = MARKER_POINT;
MyDrawing.MarkerSize = 10;
MyDrawing.Color = RGB(255,0,0);
MyDrawing.AddMethod = UTAM_ADD_OR_ADJUST;
MyDrawing.BeginIndex = sc.Index;
MyDrawing.BeginValue = sc.High[sc.Index];
sc.UseTool(MyDrawing);

//access the created drawing to obtain the value of its s_UseTool structure members
s_UseTool ExistingDrawing;
for (int i = 0; i < sc.GetACSDrawingsCount(0, 1); i++)
{
ExistingDrawing.Clear();
int Result = sc.GetACSDrawingByIndex(0, i, ExistingDrawing, 1);
SCString ExistingDrawingInfo;
ExistingDrawingInfo.Format("Drawing Index %i GetACSDrawingResult %i BeginIndex %i BeginValue %f", i, Result, ExistingDrawing.BeginIndex, ExistingDrawing.BeginValue);
sc.AddMessageToLog(ExistingDrawingInfo, 0);
}