Login Page - Create Account

Support Board


Date/Time: Sun, 24 Nov 2024 22:51:59 +0000



Post From: Issue with UseTool - PLEASE HELP

[2024-02-25 18:46:32]
sampater - Posts: 244
I have an old study that draws rectangles and text using the UseTool. Everything worked fine in version 2068.
After updating the Sierra Chart began to appear text from other call UseTool.
My guess is that as a result of the Chartbook file format change, the function Tool.Clear() for the Tool.DrawingType = DRAWING_TEXT broke down. Also the Tool.Text for other Tool.DrawingType couse the issue. It's also possible that Tool.TextAlignment is causing the problem.


Example code showing the problem:


SCSFExport scsf_DrawingMarker(SCStudyInterfaceRef sc)
{
  SCInputRef Color1 = sc.Input[1];
  SCInputRef Color2 = sc.Input[2];
  
  if (sc.SetDefaults)
  {
    sc.GraphName = "Drawing Marker";
    
    sc.AutoLoop = 1;
    sc.GraphRegion = 0;
    sc.FreeDLL = 0;
    
    Color1.Name = "Color 1";
    Color1.SetColor(0,200,0);
    
    Color2.Name = "Color 2";
    Color2.SetColor(255,0,0);
    
    
    return;
  }
  
  s_UseTool Tool;
  
  
  // Drawing Text
  Tool.Clear();
  Tool.Region = 0;
  Tool.AddMethod = UTAM_ADD_OR_ADJUST;
  Tool.LineNumber = 1;
  
  Tool.DrawingType = DRAWING_TEXT;
  Tool.FontSize = 8;
  Tool.Color = Color1.GetColor();
  Tool.BeginIndex = sc.Index;
  Tool.BeginValue = sc.High[sc.Index];
  
  Tool.Text = " TEXT ";
  Tool.TextAlignment = DT_CENTER | DT_VCENTER;
  sc.UseTool(Tool);
  
  
  // Drawing Marker
  Tool.Clear();
  Tool.ChartNumber = sc.ChartNumber;
  Tool.Region = 0;
  Tool.AddMethod = UTAM_ADD_OR_ADJUST;
  Tool.LineNumber = 2;
  
  Tool.DrawingType = DRAWING_MARKER;
  Tool.MarkerType = MARKER_X;
  Tool.Color = Color2.GetColor();
  Tool.MarkerSize = 6;
  Tool.LineWidth = 3;
  Tool.BeginIndex = sc.Index;
  Tool.BeginValue = sc.Low[sc.Index];
  
  sc.UseTool(Tool);
  
}

https://www.sierrachart.com/image.php?Image=1708886239631.png
Date Time Of Last Edit: 2024-02-28 23:25:46