Login Page - Create Account

Support Board


Date/Time: Sun, 15 Jun 2025 15:54:38 +0000



[Programming Help] - sc.SetCustomStudyControlBarButtonText vs newline char

View Count: 218

[2025-05-21 17:08:38]
User275839 - Posts: 70
I am using sc.SetCustomStudyControlBarButtonText to set the name of a custom study button. The string I am setting comes from an sc.Input[].GetString() function. I would like to have the button title be on 2 lines. However, setting a string containing a \n newline character just shows the \n in the button title and doesn't break the title into 2 lines.

However, using the control bar editing dialog = Customize Control Bar > Control Bar Button Properties > Caption to set a string containing a \n character does honor the \n and breaks the button title into 2 lines.

Is there a way via ACSIL functions to set a button title that formats using \n to break the title into 2 lines?
[2025-05-21 17:43:08]
User431178 - Posts: 711
sc.Input[].GetString() is adding an extra backslash in front of the \n, so you get the text exactly as it is written in the input setting, rather than it being treated as a newline character.
For example "Button\nText" becomes "Button\\nText" when you read it from sc.Input[].GetString().

sc.SetCustomStudyControlBarButtonText accepts newline character just fine, but in your case it does not work for the reason above.

You could split the input string on occurences of "\\n" and recombine with "\n" instead, or loop through it and replace "\\n" with "\n".
[2025-05-21 18:18:42]
User275839 - Posts: 70
Ah, I see. I will try fixing up the string before using it in the SetCustomStudyControlBarButtonText call and report back.
[2025-05-23 16:55:02]
User275839 - Posts: 70
Hello again -

I changed my code to swap in a newline character in the string from the input value. Works fine now. Thank you for pointing me in the right direction!

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

Login

Login Page - Create Account