A button on a chart
Created at 04 Aug 2020, 16:39
A button on a chart
04 Aug 2020, 16:39
Hi,
what should I do to see a button on a chart?
I wrote this and it doesn't appear:
public override void Calculate(int index)
{
Button button1 = new Button();
button1.BackgroundColor = Color.White;
button1.Text = "Button";
button1.Top = 100;
button1.Left = 100;
button1.IsVisible = true;
}
Thank you.
Replies
crou
04 Aug 2020, 18:13
I have a silly question.
I would like the button to disappear after it is clicked. I wrote a separate method, but it doesn't recognize the button inside of it.
How should I do it?
public override void Calculate(int index)
{
Button button1 = new Button();
button1.BackgroundColor = Color.White;
button1.Text = "Button";
button1.Top = 100;
button1.Left = 100;
button1.IsVisible = true;
button1.IsEnabled = true;
Chart.AddControl(button1);
button1.Click += args => CloseButton();
}
private void CloseButton()
{
button1.IsEnabled = false;
button1.IsVisible = false;
}
Thank you.
@crou
PanagiotisCharalampous
07 Sep 2020, 08:27
Hi crou,
Yes it is. See below
Chart.IndicatorAreas[0].AddControl(button1);
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
04 Aug 2020, 16:41
Hi crou,
You can check the Sample Trading Panel sample cBot that comes with the platform. It has examples of adding buttons to the charts.
Best Regards,
Panagiotis
Join us on Telegram
@PanagiotisCharalampous