Support Board
Date/Time: Mon, 20 Jan 2025 08:34:07 +0000
[Programming Help] - ACSIL Toolbar Button Status
View Count: 1765
[2018-06-01 21:04:40] |
User439067 - Posts: 48 |
I'm using a tool bar and 3 custom study buttons like a toggle. Which ever one is ON I want my study to display different information. I haven't found a method to get the current status of a button ON or OFF. The docs only show the status associated with a click event. Each time I select a button it is a permanent change to the study options until I select a different button. Any suggestions? Thank you. |
[2018-06-04 10:08:59] |
User553714 - Posts: 184 |
I found it useful not to think of a button press as having an On/Off status but rather a good way of executing a one-off instruction, (it's probably one of the best ways to do this.) Advanced Custom Study Interaction With Menus, Control Bar Buttons, Pointer Events "The ACSIL variable sc.MenuEventID indicates which ACS Control Bar Button is currently selected. The possible values are one of the ACS_BUTTON_# constants. Where # equals 1 through 50." My recollection from the testing I did is that sc.MenuEventID does not hold the integer value of the button pressed in a persistent manner and gets reset to zero shortly after each event? If that is the case, you probably need to use a secondary "persistent variable" to keep track of the on-off status of a button if that is something that is important to you. Because I use buttons for one-off executions, I always reset the appearance of the button to unpressed after each conditional test, for example; if (sc.MenuEventID == Input_ACS1button.GetInt()) { do whatever you need .... } sc.SetACSToolEnable(Input_ACS1button.GetInt(),FALSE); // This resets the button to an unpressed appearance Regards |
[2018-06-04 13:52:33] |
User439067 - Posts: 48 |
Thank you man - it certainly helped me think through the problem. Here is what I did to solve my issue. if (sc.MenuEventID != 0)
{ if (sc.MenuEventID == ACS_BUTTON_15) { if (sc.PointerEventType == SC_ACS_BUTTON_ON) { UpDegrees.SetInt(1); sc.SetACSToolEnable(ACS_BUTTON_15, FALSE); sc.FlagToReloadChartData = 1; } } } This sets the study input to the proper value and reloads the chart which creates the effect I was looking for. |
[2018-06-04 20:26:48] |
Sierra Chart Engineering - Posts: 104368 |
This is explained here: Advanced Custom Study Interaction With Menus, Control Bar Buttons, Pointer Events: Using Advanced Custom Study Control Bar Buttons for One-Time Events and Not Staying On We also updated that page with the new function names. The old names still work as well. 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, *change* to the Teton service: Sierra Chart Teton Futures Order Routing Date Time Of Last Edit: 2018-06-04 20:27:11
|
To post a message in this thread, you need to log in with your Sierra Chart account: