Login Page - Create Account

Support Board


Date/Time: Mon, 23 Jun 2025 05:25:42 +0000



SetCustomStudyControlBarButtonEnable()

View Count: 682

[2022-03-03 21:16:13]
Richard Chinn - Posts: 35
Is the SetCustomStudyControlBarButtonEnable() function supposed to change the look of the button as well as the state?

I have a code snippet that sets the enabled state to disabled or enabled depending on a flag.
I can see my snippet works because I change the button color and tooltip text when I change the enabled state but the look of the button does not change.
In other words the button only shows in the up position regardless of the enabled state when I set the state programmatically.
However; the button works correctly and looks correct when I push the button manually.
I've scanned through the documentation and support board but I can't find any other functions that would change the look of the button.
[2022-03-03 23:26:12]
Sierra_Chart Engineering - Posts: 19984
We see a change. Maybe it is not very noticeable for you though. Maybe based on color settings.

  if (sc.SetDefaults)
  {
    // Set the configuration and defaults

    sc.GraphName = "Test Function 7";

    sc.AutoLoop = 0;

    sc.UpdateAlways = 1;

    return;
  }

  static int State = 0;

  if (State == 0)
    State = 1;
  else
    State = 0;

  sc.SetCustomStudyControlBarButtonEnable(1, State);

Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2022-03-04 20:53:27]
Richard Chinn - Posts: 35
You are correct, this part of the code you show works perfectly as does mine which is only slightly different from yours.
I see that I did not do a good job explaining what is happening.

I initialize all my buttons on start up to the ENABLED state.
When the buttons are shown, they are the right color, text, and hover text but the button is not shown pushed in.
It is only when the button is initialized in the ENABLED state and BEFORE the button has been pushed that it does not display correctly.
I can push it and it will display and operate perfectly in both states with my code and the code you showed me.

I don't test for button pushes until later in my program so initialization and testing for the button push are separated.

Hope this is clear now, I'm sorry I didn't do a better job explaining it the first time.
Thanks, I love this program!!!!


if (sc.SetDefaults)
{
// Set the configuration and defaults
  
sc.GraphName = "Test Function 7";
sc.AutoLoop = 0;
sc.UpdateAlways = 1;
return;
}

static int State = 1;

// My Code to initialize buttons in the ENABLED state

sc.SetCustomStudyControlBarButtonEnable(1, State);
sc.SetCustomStudyControlBarButtonColor(1, COLOR_Red);
sc.SetCustomStudyControlBarButtonText(1, "CS 1");
sc.SetCustomStudyControlBarButtonHoverText(1, "Enabled"]);

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

Login

Login Page - Create Account