Skip to content

ButtonClickEventArgs.Button

property · ButtonClickEventArgs · cAlgo.API

DesktopCLICloud

Gets the button 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 Button Button {get;}
buttonClickEventArgs.Button: Button

Returns Button

Examples

protected override void OnStart()
{
    var button = new Button { Text = "Buy EURUSD" };
    button.Click += OnButtonClick;
    Chart.AddControl(button);
}

private void OnButtonClick(ButtonClickEventArgs args)
{
    args.Button.IsEnabled = false;
    args.Button.Text = "Order sent";
    ExecuteMarketOrder(TradeType.Buy, "EURUSD", 10000, "myLabel");
}
def on_start(self):
    button = Button()
    button.Text = "Buy EURUSD"
    button.Click += self.on_button_click
    api.Chart.AddControl(button)

def on_button_click(self, args):
    args.Button.IsEnabled = False
    args.Button.Text = "Order sent"
    api.ExecuteMarketOrder(TradeType.Buy, "EURUSD", 10000, "myLabel")