Login Page - Create Account

Support Board


Date/Time: Fri, 26 Apr 2024 15:32:34 +0000



[Programming Help] - s_UseTool : 2 colors in one string

View Count: 603

[2019-06-21 14:18:38]
User210074 - Posts: 63
Hello,
I want to put 2 colors or more in a string.
The code works but only for a color.
How can we do it ?


system ("Color 1A");/*does not work in SierraChart!*/
I tested a lot of console color coding in C ++. But nothing works.


#include "sierrachart.h"
#include <windows.h>
#include <string>

using std::string;
using std::to_string;

SCDLLName("TEST");
SCSFExport scsf_TEST(SCStudyGraphRef sc) {

SCSubgraphRef Red=sc.Subgraph[0];
SCSubgraphRef Blue=sc.Subgraph[1];

if(sc.SetDefaults){
   sc.GraphName="Test_Functions";sc.FreeDLL=1;sc.AutoLoop=1;sc.GraphRegion=0;sc.UpdateAlways=1;
   Red.Name="Red";Red.DrawStyle=DRAWSTYLE_CUSTOM_TEXT;Red.PrimaryColor=RGB(255,0,0);Red.LineWidth=10;Red.DrawZeros=false;
   Red.Name="Blue";Blue.DrawStyle=DRAWSTYLE_CUSTOM_TEXT;Blue.SecondaryColor=RGB(0,0,255);Blue.LineWidth=10;Blue.DrawZeros=false;

}/*Fin de Defaut*/

if(sc.Index==1){
  
   string UTXT{},UTXTS{};
  
   sc.DeleteACSChartDrawing(sc.ChartNumber,TOOL_DELETE_CHARTDRAWING,1);
   s_UseTool AAA;
    AAA.Clear();
    AAA.ChartNumber=sc.ChartNumber;
    AAA.Region=sc.GraphRegion;
    
    AAA.DrawingType=DRAWING_TEXT;
    
    AAA.LineNumber=1;
    AAA.BeginIndex=sc.Index;
    AAA.BeginValue=sc.Low[sc.Index];
    AAA.EndIndex=sc.Index;
    AAA.EndValue=sc.Low[sc.Index];
    AAA.FontSize=Red.LineWidth;
    AAA.AddMethod=UTAM_ADD_OR_ADJUST;
    AAA.TextAlignment=DT_CENTER;
    AAA.Color=Red.PrimaryColor;
    AAA.Color=Blue.SecondaryColor;
    
UTXT="[Text Red][Text Blue]";
    AAA.Text=UTXT.c_str();
    
   sc.UseTool(AAA);
}
}

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

Login

Login Page - Create Account