Support Board
Date/Time: Tue, 11 Mar 2025 17:35:48 +0000
[Programming Help] - Set subgraph name works only after first default setup
View Count: 570
[2022-05-01 12:30:00] |
User237846 - Posts: 3 |
Within my study, the sc.Subgraph[ID_OF_GRAPH].Name which gets set by SCInputRef CustomString (setup with several possibilities via SetCustomInputStrings()) will no longer be changed after the study was added and the defaults where changed for the first time. Changing the name is done in the study code by sc.Subgraph[ID_OF_GRAPH].Name = mySCInputRef.GetSelectedCustomString();
Subsequent changes via "Study Settings" to another CustomString will not change the showed name on top of the study anymore, while a GetIndex() still works without any problems. So how do i change the subgraph name with a new one that where choosen by another CustomString in "Study Settings"? |
[2022-05-01 13:05:57] |
User907968 - Posts: 838 |
Automatic looping: if (sc.Index == 0) { sc.Subgraph[ID_OF_GRAPH].Name = mySCInputRef.GetSelectedCustomString(); } Manual looping: if (sc.UpdateStartIndex == 0) { sc.Subgraph[ID_OF_GRAPH].Name = mySCInputRef.GetSelectedCustomString(); } |
[2022-05-01 15:02:22] |
User237846 - Posts: 3 |
Hi, if ((sc.Index == 0) || (sc.UpdateStartIndex == 0)) { sc.AddMessageToLog("sc.Index == 0 || sc.UpdateStartIndex == 0", 1); sc.Subgraph[ID_OF_GRAPH].Name = mySCInputRef.GetSelectedCustomString(); } i'm sorry, but that still does not change the name of the input in the displayed name and value above the study. The message gets printed to log, but the name still doesn't change. |
[2022-05-01 15:23:43] |
User907968 - Posts: 838 |
still does not change the name of the input in the displayed name and value above the study
Well of course it doesn't change the name of the input... It changes the name of the subgraph, which is what you asked originally. It worked exactly as expected when I tested it just now. Are you setting the subgraph name elsewhere outside of the set defaults block? Date Time Of Last Edit: 2022-05-01 15:23:50
|
[2022-05-01 16:20:42] |
User237846 - Posts: 3 |
Outside the setDefaults Block it is only changed in the if{} block above. On https://i.imgur.com/uIrqNo2.png i added a screenshot. The line on top contains the colored input items. Those names do only change once after the defaults are set. Maybe i have to break my code down to a smaller example and then try again. Or are there some examples available? Thanks! |
To post a message in this thread, you need to log in with your Sierra Chart account: