Login Page - Create Account

Support Board


Date/Time: Sat, 04 May 2024 13:12:53 +0000



Post From: sc.SetDefaults Code Block Resetting Blank Strings

[2020-07-10 11:16:05]
kas64h - Posts: 87
String Inputs that have intentionally been set to blank in code are being reset to their default values when a chart/study is closed then re-opened. For example:

SCInputRef Test = sc.Input[0];

if (sc.SetDefaults)
{
Test.SetString("Test Text");
return;
}

If the user clears the Input completely or somewhere else in code the Input is cleared [i.e. Test.SetString("");], then the Input remains blank as long as the chart/study is open.
However, once the Chartbook is closed (and saved), then re-opened, the sc.SetDefaults code block is resetting the Input back to the Default ("Test Text" here).
If the Input is set to any value other than blank, then it retains it's value as expected and is not be set back to the default.

This results in all kinds of strange behaviours with inputs that had been intentionally set to blank in a previous session, suddenly having an unintended value in the next session.

I know this used to work, and thought this was still the intended behaviour.

Thanks.