Support Board
Date/Time: Sat, 23 Nov 2024 18:00:06 +0000
Post From: Toggle Button Advanced Custom Study
[2024-08-10 05:16:39] |
User130696 - Posts: 88 |
Hello, I wrote the following code so that when ACS Button 105 is toggled (pressed once and then twice) should toggle the state of other two ACS Buttons 100 and 102 to pressed and unpressed. But pressing and undressing the Toggle Button 105, is not changing the state of buttons 100 and 102. Is there anything wrong ? #include "sierrachart.h" SCDLLName("ACS Button Toggle") SCSFExport scsf_ACSButtonToggle(SCStudyInterfaceRef sc) { if (sc.SetDefaults) { sc.GraphName = "ACS Button Toggle"; sc.StudyDescription = "This study toggles two ACS buttons based on the state of a third ACS button."; sc.AutoLoop = 1; sc.Input[0].Name = "Toggle Button"; sc.Input[0].SetInt(105); sc.Input[1].Name = "ACS Button 1"; sc.Input[1].SetInt(100); sc.Input[2].Name = "ACS Button 2"; sc.Input[2].SetInt(102); sc.Input[3].Name = "Toggle Button State"; sc.Input[3].SetInt(0); sc.Input[4].Name = "Button 1 State"; sc.Input[4].SetInt(0); sc.Input[5].Name = "Button 2 State"; sc.Input[5].SetInt(0); return; } int toggleButton = sc.Input[0].GetInt(); int acsButton1 = sc.Input[1].GetInt(); int acsButton2 = sc.Input[2].GetInt(); if (sc.PointerEventType == SC_ACS_BUTTON_ON || sc.PointerEventType == SC_ACS_BUTTON_OFF) { if (sc.MenuEventID == toggleButton) { bool toggleState = sc.GetCustomStudyControlBarButtonEnableState(toggleButton); sc.Input[3].SetInt(toggleState ? 1 : 0); if (toggleState) { sc.SetCustomStudyControlBarButtonColor(acsButton1, RGB(0,255,0)); sc.SetCustomStudyControlBarButtonColor(acsButton2, RGB(0,255,0)); sc.Input[4].SetInt(1); sc.Input[5].SetInt(1); } else { sc.SetCustomStudyControlBarButtonColor(acsButton1, RGB(128,128,128)); sc.SetCustomStudyControlBarButtonColor(acsButton2, RGB(128,128,128)); sc.Input[4].SetInt(0); sc.Input[5].SetInt(0); } } } } Date Time Of Last Edit: 2024-08-10 05:37:04
|