Skip to content

RadioButton

class cAlgo.API

DesktopCLICloud

Reporesents the Radiobutton chart control type.

Environment behaviour

CLI — not supported. Accepted without error but never displayed, so control events such as Click are never raised.

Cloud — not supported. Accepted without error but never displayed, so control events such as Click are never raised.

Definition

public class RadioButton : Control

Namespace: cAlgo.API · Group: Controls · Inherits: Control, ControlBase

Examples

using cAlgo.API;

namespace cAlgo
{
    // This sample shows how to use the Radio button chart control
    public partial class RadioButtonSample : Indicator
    {
        protected override void Initialize()
        {
            var stackPanel = new StackPanel
            {
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center,
                BackgroundColor = Color.Gold,
                Opacity = 0.7
            };

            var firstRadioButton = new RadioButton
            {
                Text = "Unchecked"
            };

            firstRadioButton.Checked += RadioButton_Checked;
            firstRadioButton.Unchecked += RadioButton_Unchecked;

            stackPanel.AddChild(firstRadioButton);

            var secondRadioButton = new RadioButton
            {
                Text = "Unchecked"
            };

            secondRadioButton.Checked += RadioButton_Checked;
            secondRadioButton.Unchecked += RadioButton_Unchecked;

            stackPanel.AddChild(secondRadioButton);

            Chart.AddControl(stackPanel);
        }

        private void RadioButton_Unchecked(RadioButtonEventArgs obj)
        {
            var radioButton = obj.RadioButton;

            radioButton.Text = "Unchecked";
        }

        private void RadioButton_Checked(RadioButtonEventArgs obj)
        {
            var radioButton = obj.RadioButton;

            radioButton.Text = "Checked";
        }

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

from cAlgo.API import *

class Test():
    def initialize(self):
        stackPanel = StackPanel()
        stackPanel.HorizontalAlignment = HorizontalAlignment.Center
        stackPanel.VerticalAlignment = VerticalAlignment.Center
        stackPanel.BackgroundColor = Color.Gold
        stackPanel.Opacity = 0.7

        firstRadioButton = RadioButton()
        firstRadioButton.Text = "Unchecked"
        firstRadioButton.Checked += self.on_radio_button_checked
        firstRadioButton.Unchecked += self.on_radio_button_unchecked

        stackPanel.AddChild(firstRadioButton)

        secondRadioButton = RadioButton()
        secondRadioButton.Text = "Unchecked"
        secondRadioButton.Checked += self.on_radio_button_checked
        secondRadioButton.Unchecked += self.on_radio_button_unchecked

        stackPanel.AddChild(secondRadioButton)

        api.Chart.AddControl(stackPanel)

    def on_radio_button_checked(self, args):
        args.RadioButton.Text = "Checked"

    def on_radio_button_unchecked(self, args):
        args.RadioButton.Text = "Unchecked"
{
  "AccessRights": "None",
  "TimeZone": "UTC",
  "IsOverlay": true
}

Constructors

Name Description
RadioButtonDesktopCLICloud Initializes a new instance of the Radiobutton class.

Properties

Name Description
ContentDesktopCLICloudControlBase Gets or sets the content.
GroupNameDesktopCLICloudstring Gets or sets the name of the group.
IsCheckedDesktopCLICloudbool Defines if the radiobutton is checked.
TextDesktopCLICloudstring Gets or sets the text.

Events

Name Description
CheckedDesktopCLICloudAction<RadioButtonEventArgs> Occurs when checked.
ClickDesktopCLICloudAction<RadioButtonEventArgs> Occurs when clicked.
UncheckedDesktopCLICloudAction<RadioButtonEventArgs> Occurs when unchecked.

Inherited members

From Control: ForegroundColor, BackgroundColor, Padding, VerticalContentAlignment, HorizontalContentAlignment, FontWeight, FontStyle, FontFamily, FontSize

From ControlBase: ResetProperty, UniqueId, Style, Left, Top, Right, Bottom, Width, Height, MinWidth, MinHeight, MaxWidth, MaxHeight, IsEnabled, IsVisible, Opacity, Margin, VerticalAlignment, HorizontalAlignment, Dock, IsHitTestVisible

See also