Skip to content

ButtonClickEventArgs

class cAlgo.API

DesktopCLICloud

Represents the button click event data.

Environment behaviour

CLI — not supported. Never raised in the CLI: the events that pass it never fire there (Button.Click).

Cloud — not supported. Never raised in the cloud: the events that pass it never fire there (Button.Click).

Definition

public class ButtonClickEventArgs

Namespace: cAlgo.API · Group: EventArgs

Examples

using cAlgo.API;

namespace cAlgo
{
    // This example shows how to use the Button object Click event ButtonClickEventArgs
    public partial class ButtonClickEventArgsSample : Indicator
    {
        protected override void Initialize()
        {
            var button = new Button
            {
                Text = "Button not clicked yet",
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center
            };

            // Whenever you click on the button the Button_Click method will be called
            button.Click += Button_Click;

            Chart.AddControl(button);
        }

        // Here we change the button test when it is clicked
        private void Button_Click(ButtonClickEventArgs obj)
        {
            obj.Button.Text = "Button Clicked";
        }

        public override void Calculate(int index)
        {
        }
    }
}
import clr
clr.AddReference("cAlgo.API")

from cAlgo.API import *

class Test():
    def initialize(self):
        button = Button()
        button.Text = "Button not clicked yet"
        button.HorizontalAlignment = HorizontalAlignment.Center
        button.VerticalAlignment = VerticalAlignment.Center

        # Whenever you click on the button the on_button_click method will be called
        button.Click += self.on_button_click

        api.Chart.AddControl(button)

    def on_button_click(self, args):
        # Here we change the button test when it is clicked
        args.Button.Text = "Button Clicked"
{
  "AccessRights": "None",
  "TimeZone": "UTC",
  "IsOverlay": true
}

Properties

Name Description
ButtonDesktopCLICloudButton Gets the button data.

See also