Login Page - Create Account

Support Board


Date/Time: Fri, 19 Apr 2024 08:09:35 +0000



[Programming Help] - Butons go UP when pressing other buttons

View Count: 593

[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);
  }
  
  
}

[2018-09-29 11:59:29]
bradh - Posts: 853
Yes, ACS buttons are radio buttons. Only one can be active at a time. Push one in, and if another is already in it pops out. Kind of limiting, and having access to 50 of them doesn't really help, don't you think?

Advanced Custom Study Interaction With Menus, Control Bar Buttons, Pointer Events: Receiving Pointer Events

It would be nice if you could group the buttons into those that are part of their own radio group, and others that are standalone. The default behavior would be the way they are now.

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account