Support Board
Date/Time: Wed, 27 Nov 2024 00:37:26 +0000
Post From: Subgraph is not updating after a custom menu event
[2023-10-13 18:26:26] |
Mark Lewis - Posts: 25 |
Okay, I've made a bunch of changes to utilize settings' inputs because I realized I needed to save the value. My input is updated by the right-click menu event, but the subgraph is not drawn in less I open up the settings for the study and click okay. Any ideas? #include "sierrachart.h" SCDLLName("My Studies") SCSFExport scsf_BalanceZones(SCStudyInterfaceRef sc) { SCString MessageText; SCSubgraphRef Subgraph_BalanceZoneTop = sc.Subgraph[0]; SCSubgraphRef Subgraph_BalanceZoneBottom = sc.Subgraph[1]; SCInputRef BalanceHigh = sc.Input[0]; SCInputRef BalanceLow = sc.Input[1]; if (sc.SetDefaults) { sc.GraphName = "Balance Zones"; sc.StudyDescription = ""; sc.DrawZeros = 0; sc.GraphRegion = 0; sc.ValueFormat = 3; sc.AutoLoop = 1; Subgraph_BalanceZoneTop.Name = "Balance zone top"; Subgraph_BalanceZoneBottom.Name = "Balnce zone bottom"; BalanceHigh.Name = "Balance high"; BalanceHigh.SetFloat(0); BalanceLow.Name = "Balance low"; BalanceLow.SetFloat(0); return; } int& r_MenuID = sc.GetPersistentInt(1); if (sc.LastCallToFunction) { sc.RemoveACSChartShortcutMenuItem(sc.ChartNumber, r_MenuID); return; } if (sc.UpdateStartIndex == 0) { if (r_MenuID <= 0) { r_MenuID = sc.AddACSChartShortcutMenuItem(sc.ChartNumber, "Draw balance zones"); } return; } s_UseTool ChartDrawing; if (sc.MenuEventID != 0 && sc.MenuEventID == r_MenuID) { int selectedLineNumber = sc.GetLineNumberOfSelectedUserDrawnDrawing(); sc.GetUserDrawnDrawingByLineNumber(0, selectedLineNumber, ChartDrawing); BalanceHigh.SetFloat(ChartDrawing.BeginValue); BalanceLow.SetFloat(ChartDrawing.EndValue); } float BalanceHighVal = BalanceHigh.GetFloat(); float BalanceLowVal = BalanceLow.GetFloat(); Subgraph_BalanceZoneTop[sc.Index] = BalanceHighVal; Subgraph_BalanceZoneBottom[sc.Index] = BalanceLowVal; } |