Login Page - Create Account

Support Board


Date/Time: Thu, 06 Mar 2025 19:13:59 +0000



Post From: ACSIL string

[2022-02-07 14:02:22]
User907968 - Posts: 836
curString and Prefix will output fine to the message log, and will be the same, yet it will continue to add the prefix to the text.

Yes, because you are comparing the full text of the drawing object against the prefix, therefore they will never be equal (except when the drawing had no text to begin with) and the prefix will always be added again.

Instead you could use the example below, which would only compare characters from the beginning of the string, up to the length of the prefix string.

while( sc.GetUserDrawnChartDrawing(sc.ChartNumber, DRAWING_HORIZONTAL_RAY , DrawingObject, DrawingIndex) )
{
DrawingIndex++;

if (Prefix.CompareNoCase(DrawingObject.Text, Prefix.GetLength()) == 0)
continue;

sc.AddMessageToLog(DrawingObject.Text, 1);
sc.AddMessageToLog(Prefix, 1);

DrawingObject.Text = Prefix + " " + DrawingObject.Text;
DrawingObject.TextAlignment = DT_RIGHT | DT_BOTTOM;
sc.UseTool(DrawingObject);
}