Support Board
Date/Time: Fri, 28 Feb 2025 13:39:01 +0000
Can't write "%" sign to the Chart with Text Tool
View Count: 463
[2021-08-17 14:59:05] |
PS2004 - Posts: 47 |
Hi! When I want to write text to the Chart, and the text includes "%", the Sierra Chart crashes, or when I try to debug, the debug indicates error (Error.png attached). I read the documentation here, and there is nothing mentioned about writing percent signs. Using Drawing Tools From an Advanced Custom Study: s_UseTool::Text The SCString's documentation here says: ACSIL Programming Concepts: SCString Methods "The Format() function overwrites the contents of the SCString object according to the given parameters. This function works the same as the C++ Standard Library printf() function." But when using printf() I can write percent signs ("%%"). The following code will demonstrate my claim: #include "sierrachart.h"
SCDLLName("WriteToSreen_DEMO") SCSFExport scsf_WriteToSreen_DEMO(SCStudyInterfaceRef sc) { if (sc.SetDefaults) { sc.GraphName = "WriteToSreen_DEMO"; sc.AutoLoop = 0; //Automatic looping is disabled. return; } SCString Text1; Text1.Format("sample text with percent sign %%"); //Adding Tool int& LineNumber = sc.GetPersistentInt(0); s_UseTool OnScreenText_Tool; OnScreenText_Tool.Clear(); OnScreenText_Tool.ChartNumber = sc.ChartNumber; OnScreenText_Tool.LineNumber = LineNumber; OnScreenText_Tool.AddMethod = UTAM_ADD_OR_ADJUST; OnScreenText_Tool.DrawingType = DRAWING_TEXT; OnScreenText_Tool.Color = COLOR_BLACK; OnScreenText_Tool.FontBackColor = COLOR_WHITE; OnScreenText_Tool.Text.Format(Text1); OnScreenText_Tool.MultiLineLabel = 1; OnScreenText_Tool.FontSize = 40; OnScreenText_Tool.FontBold = true; OnScreenText_Tool.Region = sc.GraphRegion; OnScreenText_Tool.UseRelativeVerticalValues = 1; OnScreenText_Tool.BeginValue = 10; OnScreenText_Tool.BeginDateTime = 1; sc.UseTool(OnScreenText_Tool); LineNumber = OnScreenText_Tool.LineNumber; } When I try to write the same SCString to the Message Log, it works perfectly. |
To post a message in this thread, you need to log in with your Sierra Chart account: