Login Page - Create Account

Support Board


Date/Time: Sat, 20 Apr 2024 13:23:21 +0000



[Programming Help] - s_UseTool in multiple GraphRegions on same chart does not render

View Count: 513

[2020-07-05 17:43:45]
mm3599 - Posts: 13
I'm using the s_UseTool object on 2 studies.
One study is added to GraphRegion 0
Another study is added to GraphRegion 1

Each study uses the same method for creating a tool.

Study 1 Function:

s_UseTool CreateTextUseToolFunc(SCStudyGraphRef sc, SCString SDRangeValue, float loc, int Index) {
  
  // Using Drawing Tools From an Advanced Custom Study: Using Tools with sc.UseTool()
  s_UseTool Tool;

  Tool.Clear();
  Tool.ChartNumber = sc.ChartNumber;

  Tool.DrawingType = DRAWING_TEXT;

  Tool.BeginIndex = Index;
  Tool.BeginValue = loc;
  Tool.LineNumber = Index;

  Tool.Color = RGB(0,200,200);
  Tool.Text = SDRangeValue;

  Tool.LineWidth = 7;
  Tool.AddMethod = UTAM_ADD_OR_ADJUST;
  
  return Tool;
}

This calls function 1:

s_UseTool new_text_tool = CreateTextUseToolFunc(sc, Output1, Array_MACDP_PLL_SD3_Range_Location[sc.Index], sc.Index);
int line_number;
line_number = new_text_tool.LineNumber;
sc.UseTool(new_text_tool);

Study 2 Function:

s_UseTool CreateTextUseToolROCFunc(SCStudyGraphRef sc, SCString last_pll_roc_diff, float loc, int Index) {

  // Using Drawing Tools From an Advanced Custom Study: Using Tools with sc.UseTool()
  s_UseTool Tool2;

  Tool2.Clear();
  Tool2.ChartNumber = sc.ChartNumber;

  Tool2.DrawingType = DRAWING_TEXT;

  Tool2.BeginIndex = Index;
  Tool2.BeginValue = loc;
  Tool2.LineNumber = Index;

  Tool2.Color = RGB(0,200,200);
  Tool2.Text = last_pll_roc_diff;

  Tool2.LineWidth = 7;
  Tool2.AddMethod = UTAM_ADD_OR_ADJUST;
  
  return Tool2;
}

This calls function 2:

s_UseTool new_text_tool_roc = CreateTextUseToolROCFunc(sc, Output2, Array_Subgraph_ROC_Last_PLL_Diff_Location[sc.Index], sc.Index);
int line_number2;
line_number2 = new_text_tool_roc.LineNumber;  
sc.UseTool(new_text_tool_roc);  
  

The s_UseTool study added to GraphRegion 1:
a) does not render
b) causes the s_UseTool on GraphRegion 0 to not render

When I use s_UseTool on GraphRegion 0 by itself, s_UseTool renders correctly
[2020-07-05 17:50:53]
mm3599 - Posts: 13
Version: 2113 64-bit(31507M)

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account