Support Board
Date/Time: Sat, 28 Dec 2024 23:42:09 +0000
How large can SCString be?
View Count: 1098
[2016-01-31 23:43:07] |
@sstfrederik - Posts: 404 |
Hi, I am building a text block and writing that to screen with s_UseTool. In below code MyLineText is added to the SCString. How many text can a SCString have? When I have a few more lines they will not display. Any other away to solve this than using s_UseTool at every line? Thanks. Frederik SCString str_Temp = DisplayTextString; DisplayTextString.Format("%s%s%s", str_Temp.GetChars(), "\r\n", MyLineText.GetChars()); |
[2016-02-01 00:19:26] |
Sierra Chart Engineering - Posts: 104368 |
SCString has no limitation, but you might be encountering limitations with the Windows operating system when the text is being outputted to the chart window. Without examining the code we are also not sure how multiline text is handled within Sierra Chart and whether that is properly passed to the OS. We will need to check on this. Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service: Sierra Chart Teton Futures Order Routing |
[2016-02-01 01:58:46] |
Al SC Developer - Posts: 434 |
To build a multi line text block, be sure to use "\n" as the delimiter and also set the MultiLineLabel flag to a value of one in the UseTool structure. The documentation is being updated with that info. |
[2016-02-01 20:52:56] |
@sstfrederik - Posts: 404 |
I did the above, but not all lines are displayed as before. Does this need an update of SC?
|
[2016-02-01 21:23:13] |
Al SC Developer - Posts: 434 |
No, there are no changes required in SC. In the next version, we have added a simple sample study "UseTool Example: Multiline Text" which shows how this works. It is located in routine scsf_UseToolExampleMultilineText in studies.cpp. Here is a portion of that code: s_UseTool Tool; Tool.ChartNumber = sc.ChartNumber; int &LineNumber = sc.GetPersistentInt(1); if(LineNumber != 0) Tool.LineNumber = LineNumber; Tool.Region = 0; Tool.DrawingType = DRAWING_TEXT; Tool.AddMethod = UTAM_ADD_OR_ADJUST; Tool.Text = "Text Example\nSecond Line\nThird Line\nForth Line"; Tool.BeginIndex = BarIndex; Tool.BeginValue = sc.Close[BarIndex]; Tool.Color = COLOR_YELLOW; Tool.MultiLineLabel = 1; Tool.FontFace = sc.GetChartTextFontFaceName(); Tool.FontSize = 14; Tool.FontBold = 1; sc.UseTool(Tool); LineNumber = Tool.LineNumber; This code will draw four lines of text 20 bars back. Date Time Of Last Edit: 2016-02-01 21:25:18
|
[2016-02-01 21:46:10] |
@sstfrederik - Posts: 404 |
Ok. thanks. I double checked my code. Still no change. In this case DisplayTextString has 12 lines. Any recommendations? //inside a for loop {
SCString MyLineText; MyLineText += "somestring"; SCString str_Temp = DisplayTextString; DisplayTextString.Format("%s%s%s", str_Temp.GetChars(), "\n", MyLineText.GetChars()); ///} s_UseTool Tool; Tool.ChartNumber = sc.ChartNumber; Tool.DrawingType = DRAWING_TEXT; Tool.BeginDateTime = 4; Tool.UseRelativeVerticalValues = true; Tool.BeginValue = 100; Tool.MultiLineLabel = 1; Tool.Region = sc.GraphRegion; Tool.Color = RGB(0, 0, 255); // Set Tool color to Blue //no news to display if (TotalNewsLines == 0) Tool.Text.Format("%s","No future news entries for this week with these filters"); else Tool.Text.Format("%s",DisplayTextString.GetChars()); Tool.AddMethod = UTAM_ADD_OR_ADJUST; Tool.ReverseTextColor = 0; sc.UseTool(Tool); |
[2016-02-02 19:53:57] |
@sstfrederik - Posts: 404 |
I still have the line breaking problem when displaying multiple lines. Anything else that can be done?
|
[2016-02-03 14:06:53] |
Al SC Developer - Posts: 434 |
I would suspect you are not building your strings properly. Instead of using Format(), just build the string using concatenation and then assign: SCString Temp = "Line 1; Temp += "\n"; Temp += "Line 2"; Temp += "\n"; Temp += "Line 3; ... Tool.Text = Temp; |
[2016-02-03 17:39:42] |
@sstfrederik - Posts: 404 |
Ok. Got it working now. Thanks.
|
To post a message in this thread, you need to log in with your Sierra Chart account: