Login Page - Create Account

Support Board


Date/Time: Sun, 28 Apr 2024 16:33:58 +0000



Post From: Alignment of 3 columns of text with s_UseTool TextAlignment

[2018-12-17 11:28:29]
User210074 - Posts: 63
Hello,
I would like to make 3 columns of text.
I have to horizontally align 3 columns on the same price
I managed to do it for 2.
But as for 3, nothing to do.
I can not align horizontally on the second column.
Using all possibilities of this page .
I can not do it like your NUMBERBAR.
I have no idea to do it.
Can you explain to me how you do it?

test : For 2

#include "sierrachart.h"
#include <iostream>
#include <string>
using std::string;
using std::to_string;

SCDLLName("Test");
SCSFExport scsf_Test(SCStudyInterfaceRef sc){

SCSubgraphRef A = sc.Subgraph[0];

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

   sc.DeleteACSChartDrawing(sc.ChartNumber,TOOL_DELETE_CHARTDRAWING,1);
   sc.DeleteACSChartDrawing(sc.ChartNumber,TOOL_DELETE_CHARTDRAWING,2);
   s_UseTool AAB;
   AAB.Clear();
   AAB.ChartNumber=sc.ChartNumber;
   AAB.Region=sc.GraphRegion;
   AAB.DrawingType=DRAWING_TEXT;
   AAB.LineNumber=1;
   AAB.BeginIndex=sc.Index;
   AAB.BeginValue=sc.Low[sc.Index];
   AAB.EndIndex=sc.Index;
   AAB.EndValue=sc.Low[sc.Index];
   AAB.Color=A.PrimaryColor;
   AAB.FontSize=A.LineWidth;
   AAB.AddMethod=UTAM_ADD_OR_ADJUST;
   AAB.TextAlignment = DT_RIGHT;
   string ATXT="1234|5678";
   AAB.Text=ATXT.c_str();
   sc.UseTool(AAB);
   s_UseTool AAA;
   AAA.Clear();
   AAA.ChartNumber=sc.ChartNumber;
   AAA.Region=sc.GraphRegion;
   AAA.DrawingType=DRAWING_TEXT;
   AAA.LineNumber=2;
   AAA.BeginIndex=sc.Index;
   AAA.BeginValue=sc.Low[sc.Index];
   AAA.EndIndex=sc.Index;
   AAA.EndValue=sc.Low[sc.Index];
   AAA.Color=A.PrimaryColor;
   AAA.FontSize=A.LineWidth;
   AAA.AddMethod=UTAM_ADD_OR_ADJUST;
   AAA.TextAlignment = DT_LEFT;
   string BTXT="abcd|efgh";
   AAA.Text=BTXT.c_str();
   sc.UseTool(AAA);
}
it work.

But for 3 no

#include <string>
using std::string;
using std::to_string;

SCDLLName("Test");
SCSFExport scsf_Test(SCStudyInterfaceRef sc){

SCSubgraphRef A = sc.Subgraph[0];

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

   sc.DeleteACSChartDrawing(sc.ChartNumber,TOOL_DELETE_CHARTDRAWING,1);
   sc.DeleteACSChartDrawing(sc.ChartNumber,TOOL_DELETE_CHARTDRAWING,2);
sc.DeleteACSChartDrawing(sc.ChartNumber,TOOL_DELETE_CHARTDRAWING,3);
   s_UseTool AAB;
   AAB.Clear();
   AAB.ChartNumber=sc.ChartNumber;
   AAB.Region=sc.GraphRegion;
   AAB.DrawingType=DRAWING_TEXT;
   AAB.LineNumber=1;
   AAB.BeginIndex=sc.Index;
   AAB.BeginValue=sc.Low[sc.Index];
   AAB.EndIndex=sc.Index;
   AAB.EndValue=sc.Low[sc.Index];
   AAB.Color=A.PrimaryColor;
   AAB.FontSize=A.LineWidth;
   AAB.AddMethod=UTAM_ADD_OR_ADJUST;
   AAB.TextAlignment = DT_RIGHT;
   string ATXT="1234|5678";
   AAB.Text=ATXT.c_str();
   sc.UseTool(AAB);
   s_UseTool AAA;
   AAA.Clear();
   AAA.ChartNumber=sc.ChartNumber;
   AAA.Region=sc.GraphRegion;
   AAA.DrawingType=DRAWING_TEXT;
   AAA.LineNumber=2;
   AAA.BeginIndex=sc.Index;
   AAA.BeginValue=sc.Low[sc.Index];
   AAA.EndIndex=sc.Index;
   AAA.EndValue=sc.Low[sc.Index];
   AAA.Color=A.PrimaryColor;
   AAA.FontSize=A.LineWidth;
   AAA.AddMethod=UTAM_ADD_OR_ADJUST;
   AAA.TextAlignment = DT_LEFT;
   string BTXT="abcd|efgh";
   AAA.Text=BTXT.c_str();
   sc.UseTool(AAA);
s_UseTool AAC;
   AAC.Clear();
   AAC.ChartNumber=sc.ChartNumber;
   AAC.Region=sc.GraphRegion;
   AAC.DrawingType=DRAWING_TEXT;
   AAC.LineNumber=3;
   AAC.BeginIndex=sc.Index;
   AAC.BeginValue=sc.Low[sc.Index];
   AAC.EndIndex=sc.Index;
   AAC.EndValue=sc.Low[sc.Index];
   AAC.Color=A.PrimaryColor;
   AAC.FontSize=A.LineWidth;
   AAC.AddMethod=UTAM_ADD_OR_ADJUST;
   AAC.TextAlignment = DT_LEFT;
   string CTXT="1234|5678";
   AAC.Text=CTXT.c_str();
   sc.UseTool(AAC);

}

Attachment Deleted.
imagenbr.PNG / V - Attached On 2018-12-17 11:04:54 UTC - Size: 12.19 KB - 297 views
imagenb2.PNG / V - Attached On 2018-12-17 11:05:08 UTC - Size: 8.38 KB - 250 views