Login Page - Create Account

Support Board


Date/Time: Sat, 18 May 2024 22:45:34 +0000



Post From: AddAsUserDrawnDrawing AND LineNumber behaviour

[2016-11-13 20:14:57]
kas64h - Posts: 87
I seem to have several issues when using ACSIL to draw multiple user drawn drawings (AddAsUserDrawnDrawing set to 1), which are probably best explained using your scsf_UseToolExampleMultipleDrawingsSameIndex example code in the studies.cpp file.


********** ISSUE 1 - Attempting to add a 2nd drawing with Tool.AddAsUserDrawnDrawing = 1 under different LineNumbers **********

Using the scsf_UseToolExampleMultipleDrawingsSameIndex example code, I add the line Tool.AddAsUserDrawnDrawing = 1; immediately above the existing line Tool.DrawingType = DRAWING_MARKER;

This code still runs fine and produces 2 'user drawn' markers, but in accordance with your documentation there is a potential issue.

As AddAsUserDrawnDrawing is set to 1, drawings with negative LineNumbers will be produced.
However, in order to 'force' the automatic assignment of a LineNumber when drawing non-user drawn drawings your code sets the LineNumber to -1 (Tool.LineNumber = -1;)
Furthermore, under the LineNumber documentation, it explicitly states: "Do not use a negative LineNumber when s_UseTool::AddAsUserDrawnDrawing is set to a nonzero number because a negative number may conflict with other user drawn Chart Drawings added by ACSIL and also through the Sierra Chart user interface."

Considering the above, I commented out the Tool.LineNumber = -1; line of code (along with the else; statement preceding it)

However, if I now run the code, only he first drawing gets drawn, and not the second.
Interestingly, if I replace Tool.AddMethod = UTAM_ADD_OR_ADJUST; with Tool.AddMethod = UTAM_ADD_ALWAYS; then the second drawing gets drawn, and not the first.

I have found 3 ways to code around it, but am unclear if any are recommended, or whether any kind of bug fix is required?

Method 1) Simply re-introduce Tool.LineNumber = -1; and accept the potential negative number conflict

Method 2) Replace Tool.LineNumber = -1; with either Tool.LineNumber = 0; or Tool.LineNumber = 1; I'm assuming this is recognized as an illegal LineNumber when Tool.AddAsUserDrawnDrawing is set to 1, and so an automatic negative LineNumber is generated?

Method 3) Comment out the Tool.LineNumber = -1; line of code (along with the else; statement preceding it), clear the Tool (i.e. Tool.Clear()), and re-assign all values back to the Tool (except LineNumber which is left unset).

All 3 methods work. I don't know if any are favourable or whether a bug fix is required?
From the documentation, I'd expected to have to leave Tool.LineNumber completely unset.


********** ISSUE 2 - Attempting to add a 2nd drawing with Tool.AddAsUserDrawnDrawing = 1 using the SAME LineNumber **********

Again using the original scsf_UseToolExampleMultipleDrawingsSameIndex example code, if I try to add two user drawn drawings under the SAME LineNumber, then only the first drawing ever gets drawn, and not the second.

So I add/alter the following code:

1) Add the code Tool.AddAsUserDrawnDrawing = 1; immediately above the existing Tool.DrawingType = DRAWING_MARKER; line of code
2) Replace Tool.AddMethod = UTAM_ADD_OR_ADJUST; with Tool.AddMethod = UTAM_ADD_ALWAYS;
3) Add the code LineNumber_2 = LineNumber_1; immediately above the existing if (LineNumber_2 != 0) line of code

When this code is run, only the first drawing is drawn, never the second.

If I simply comment out the Tool.AddAsUserDrawnDrawing = 1; line of code, then both non-user drawn drawings are successfully drawn (and I can see from debugging that they're both drawn under the same LineNumber).

So the issue definitely seems to be trying to draw them as user drawn drawings.

Even if I clear out the Tool (Tool.Clear()) and reset it (including the LineNumber with the original LineNumber from the first drawing), the second drawing is still not drawn.

This doesn't seem correct.

*********** One final question regarding the function sc.GetUserDrawingByLineNumber() **********

When user drawn drawings are drawn under the same LineNumber using ACSIL, I understand when they're retrieved using the sc.GetUserDrawingByLineNumber() function, they will each have a separate and distinct DrawingIndex() value.

My question is simply, when retrieving user drawn drawings using this function, is it possible to set the drawing properties (i.e. text for example), for each drawing individually - i.e. so each drawing could have different text, or if you change something on one drawing it's changed for all the drawings under this LineNumber (making it impossible for each to have separate and distinct text)?

I have been unable to test this, due to Issues 1 and 2 above.

I am using Sierra build 1481.

Thanks.