Support Board
Date/Time: Tue, 26 Nov 2024 06:57:47 +0000
Post From: Persistent variables not working?
[2014-04-09 20:35:54] |
joshtrader - Posts: 488 |
I've created two charts (SC 1116 non-.net version). One is #11, and a custom study sets a persistent integer variable. The other is #12 and another test custom study references this variable. As you can see from this image, there is indeed a reference established: http://screencast.com/t/Z1TRw1UT6bm Yet in the debut output, notice the highlighted lines in the message log: http://screencast.com/t/Pv4wGomMv i1 is still set to zero as you can see in the above output, even though the source chart is setting it to 25. Here is the very simple code, it is very simple, yet it does not seem to be working. Both charts have only the single custom test study. I have done this on a blank workbook with only the two charts open as well, with the same result. What is going on here??: SCSFExport scsf_SetPVars(SCStudyInterfaceRef sc) { if (sc.SetDefaults) { sc.GraphName="Set PVars Test"; sc.StudyDescription=""; sc.AutoLoop = 0; sc.GraphRegion = 0; sc.FreeDLL = 1; return; } if (sc.Index == 0) { sc.PersistVars->Integers[0] = 25; SCString buffer; buffer.Format("Just set Integers0 to: %d", sc.PersistVars->Integers[0]); sc.AddMessageToLog(buffer,0); } } SCSFExport scsf_GetPVars(SCStudyInterfaceRef sc) { if (sc.SetDefaults) { sc.GraphName="Get PVars Test"; sc.StudyDescription=""; sc.AutoLoop = 0; sc.GraphRegion = 0; sc.FreeDLL = 1; return; } const s_sc::s_PersistentVariables * p_PersistVars = sc.GetStudyPersistentVariablesFromChartUsingID(11, 1); // chart #11, study #1 if (p_PersistVars) { SCString buffer; buffer.Format("Integer i1 is: %d", p_PersistVars->i1); sc.AddMessageToLog(buffer,0); } } Date Time Of Last Edit: 2014-04-09 20:41:59
|