Login Page - Create Account

Support Board


Date/Time: Thu, 02 May 2024 05:41:03 +0000



Post From: Butons go UP when pressing other buttons

[2018-09-27 12:40:51]
Jezz - Posts: 33
Hi

I've written the following code for testing button behavior, and whenever a button is pressed, two events are fired,
one for the previous one selected (going up) and another (going down) for the one being pressed.
It looks that my buttons are working as radio buttons (only one can be enabled).

-Is it posible to unlink buttons, so they work independently, and have their own status?

I've found the function SetCustomStudyControlBarButtonEnable, but is there any way to Get its state.


Thanks in advance


#include "sierrachart.h"

SCDLLName("devTmp")
// During development set this flag to 1, so the DLL can be rebuilt without restarting Sierra Chart. When development is completed, set it to 0 to improve performance.
int FREE_DLL = true;

SCString S; // used for Messages
const int B1 = ACS_BUTTON_10;
const int B2 = ACS_BUTTON_11;
const int B3 = ACS_BUTTON_12;

SCSFExport scsf_TestButtons(SCStudyInterfaceRef sc)
{
  if (sc.SetDefaults)
  {
    sc.GraphName = "Testing Buttons";    
    sc.FreeDLL = FREE_DLL;
    sc.AutoLoop = 1;     
    return;
  }
  //sc.ReceivePointerEvents = ACS_RECEIVE_POINTER_EVENTS_WHEN_ACS_BUTTON_ENABLED;
  if (sc.IsFullRecalculation)
  {
    sc.SetCustomStudyControlBarButtonText(B1, "B1");
    sc.SetCustomStudyControlBarButtonText(B2, "B2");
    sc.SetCustomStudyControlBarButtonText(B3, "B3");
    sc.SetCustomStudyControlBarButtonEnable(B1, 0);
    sc.SetCustomStudyControlBarButtonEnable(B2, 0);
    sc.SetCustomStudyControlBarButtonEnable(B3, 0);
  }
  if (sc.MenuEventID == B1 )
  {
    S.Format("Button %i clicked",B1);sc.AddMessageToLog(S, 0);
  }
  if (sc.MenuEventID == B2 )
  {
    S.Format("Button %i clicked",B2);sc.AddMessageToLog(S, 0);
  }
  if (sc.MenuEventID == B3 )
  {
    S.Format("Button %i clicked",B3);sc.AddMessageToLog(S, 0);
  }
  
  
}