Login Page - Create Account

Support Board


Date/Time: Sat, 30 Nov 2024 00:59:28 +0000



Post From: No Build any files cpp

[2023-01-05 02:10:02]
User183724 - Posts: 183
/* This isn't exactly what you want but you may be able to use it or build from it... my old Hello World program. one of the first programs I got to work. It's only job is to print Hello World on the screen. I added sc.AddMessageToLog(); to the bottom so it will print Hello World to your Message log since your code had a text output to file. hope it helps you. Ive refered to it often. I only Remote Build my files so if you are using a local compiler, I can't help you there. Good luck */


#include "sierrachart.h" // must always be top line

// Name of the custom study. // should be second line of code
SCDLLName("HelloWorldv1")

/*==========================================================================*/
SCSFExport scsf_HelloWorldv1(SCStudyInterfaceRef sc)
{
  SCSubgraphRef StatusText = sc.Subgraph[0];

  SCInputRef Input_HorizontalPosition = sc.Input[0];
  SCInputRef Input_VerticalPosition = sc.Input[1];
  SCInputRef Input_TransparentLabelBackground = sc.Input[3];

  if (sc.SetDefaults)
  {
    // Set the configuration and defaults

    sc.GraphName = "HelloWorldv1"; // all graphs to be displayed must have a name
    sc.AutoLoop = 1;
    sc.GraphRegion = 0;
    sc.ValueFormat = 0;

    StatusText.Name = "Status Text";
    StatusText.LineWidth = 20;
    StatusText.DrawStyle = DRAWSTYLE_CUSTOM_TEXT;
    StatusText.PrimaryColor = RGB(255, 255, 255);
    StatusText.SecondaryColor = RGB(0, 0, 160);
    StatusText.SecondaryColorUsed = true;
    StatusText.DisplayNameValueInWindowsFlags = 1;

    Input_HorizontalPosition.Name = "Initial Horizontal Position From Left (1-150)";
    Input_HorizontalPosition.SetInt(70); // change initial postion horizontally
    Input_HorizontalPosition.SetIntLimits(1, 150);

    Input_VerticalPosition.Name = "Initial Vertical Position From Bottom (1-100)";
    Input_VerticalPosition.SetInt(100); // change initial postion vertically
    Input_VerticalPosition.SetIntLimits(1, 100);
  
    Input_TransparentLabelBackground.Name = "Transparent Label Background";
    Input_TransparentLabelBackground.SetYesNo(false);

    
    return;
  }


  // Do data processing
  
  SCString TextToDisplay;
  
   TextToDisplay = "Hello World!"; // change as req
  
  int HorizontalPosition = Input_HorizontalPosition.GetInt();
  int VerticalPosition = Input_VerticalPosition.GetInt();


  int TransparentLabelBackground = Input_TransparentLabelBackground.GetYesNo();
  
sc.AddAndManageSingleTextDrawingForStudy(sc, false, HorizontalPosition, VerticalPosition, StatusText, TransparentLabelBackground, TextToDisplay, 0);  
  
  sc.AddMessageToLog(TextToDisplay,1);
  
}