Login Page - Create Account

Support Board


Date/Time: Sun, 05 May 2024 11:55:04 +0000



Post From: Strange behaviour when populating sc.Input array

[2018-12-17 20:12:56]
binaryduke - Posts: 360
It appears that either using non-consecutive members in the array (i.e. leaving unpopulated array members) or larger values results in strange behaviour:


#include "sierrachart.h"
SCDLLName("Custom Study DLL")
SCSFExport scsf_TemplateFunction(SCStudyInterfaceRef sc)
{

  if (sc.SetDefaults)
  {
    sc.GraphName = "Template Function";

    sc.AutoLoop = 1; //Automatic looping is enabled.
    
    sc.Subgraph[0].Name = "Name";
    sc.Subgraph[0].DrawStyle = DRAWSTYLE_LINE;
    sc.Subgraph[0].PrimaryColor = RGB (0, 255, 0);
    
    sc.Input[0].Name = "Float Input 1";
    sc.Input[0].SetFloat(0.0f);
    sc.Input[3].Name = "Float Input 2";
    sc.Input[3].SetFloat(0.0f);
    sc.Input[5].Name = "Float Input 3";
    sc.Input[5].SetFloat(0.0f);
    sc.Input[38].Name = "Float Input 4";
    sc.Input[38].SetFloat(0.0f);
    sc.Input[46].Name = "Float Input 5";
    sc.Input[46].SetFloat(0.0f);
    sc.Input[125].Name = "Float Input 6";
    sc.Input[125].SetFloat(0.0f);
    return;
  }
}

Only displays inputs [0], [3] and [5]. I have tested the array size iterating from 0 to SC_INPUTS_AVAILABLE and can populate the maximum number of inputs. I have repeated the test with a modulo function to only populate every other array member and this is fine too, yet the code above does not populate members 38, 46 or 125.

Is there a need to ensure contiguous member usage of the sc.Input array?
Date Time Of Last Edit: 2018-12-17 20:35:14