Login Page - Create Account

Support Board


Date/Time: Thu, 02 May 2024 22:05:19 +0000



Post From: Button menu toggle

[2021-01-27 08:12:36]
User907968 - Posts: 802
I'm trying to stay within ACSIL
Sure, this is no problem.

A simple example based on post #2, using color to indicate button state and setting input state accordingly.


  if (sc.IsFullRecalculation)//Is full recalculation
  {
    // set ACS Tool Control Bar tool tip
    sc.SetCustomStudyControlBarButtonHoverText(Input_ACSButtonNumber.GetInt(), "Trade CCI Enable/Disable");
    sc.SetCustomStudyControlBarButtonHoverText(Input_ACSButtonNumber1.GetInt(), "Trade Long");

    // set Custom Study Control Bar button text if the input to allow custom properties is not true. Otherwise, rely upon what the user sets.
    if (!Input_AllowCustomPropertiesForControlBarButton.GetYesNo())
      sc.SetCustomStudyControlBarButtonText(Input_ACSButtonNumber.GetInt(), "TCCI");

    if (!Input_AllowCustomPropertiesForControlBarButton1.GetYesNo())
      sc.SetCustomStudyControlBarButtonText(Input_ACSButtonNumber1.GetInt(), "Long");

    // set buttons to disabled i.e. not pushed in state
    sc.SetCustomStudyControlBarButtonEnable(Input_ACSButtonNumber.GetInt(), 0);
    sc.SetCustomStudyControlBarButtonEnable(Input_ACSButtonNumber1.GetInt(), 0);

    // set button color to show enabled / disabled state
    if (Enabled.GetYesNo())
      sc.SetCustomStudyControlBarButtonColor(Input_ACSButtonNumber.GetInt(), COLOR_GREEN);
    else
      sc.SetCustomStudyControlBarButtonColor(Input_ACSButtonNumber.GetInt(), COLOR_RED);

    if (Long.GetYesNo())
      sc.SetCustomStudyControlBarButtonColor(Input_ACSButtonNumber1.GetInt(), COLOR_GREEN);
    else
      sc.SetCustomStudyControlBarButtonColor(Input_ACSButtonNumber1.GetInt(), COLOR_RED);
  }

  if (sc.MenuEventID != 0)
  {
    if (sc.MenuEventID == Input_ACSButtonNumber.GetInt())
    {
      // reset button to disabled i.e. not pushed in state
      sc.SetCustomStudyControlBarButtonEnable(Input_ACSButtonNumber.GetInt(), 0);

      if (Enabled.GetYesNo())
      {
        // change state of input to disabled and set color accordingly
        Enabled.SetYesNo(0);
        sc.SetCustomStudyControlBarButtonColor(Input_ACSButtonNumber.GetInt(), COLOR_RED);
      }
      else
      {
        // change state of input to disabled and set color accordingly
        Enabled.SetYesNo(1);
        sc.SetCustomStudyControlBarButtonColor(Input_ACSButtonNumber.GetInt(), COLOR_GREEN);
        
      }

    }
    else if (sc.MenuEventID == Input_ACSButtonNumber1.GetInt())
    {
      sc.SetCustomStudyControlBarButtonEnable(Input_ACSButtonNumber1.GetInt(), 0);

      if (Long.GetYesNo())
      {
        Long.SetYesNo(0);
        sc.SetCustomStudyControlBarButtonColor(Input_ACSButtonNumber1.GetInt(), COLOR_GREEN);
      }
      else
      {
        Long.SetYesNo(1);
        sc.SetCustomStudyControlBarButtonColor(Input_ACSButtonNumber1.GetInt(), COLOR_RED);
      }
    }
  }