Skip to content

CheckBox

class cAlgo.API

DesktopCLICloud

Represents the Checkbox.

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 CheckBox : Control

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

Examples

using cAlgo.API;

namespace cAlgo
{
    // This sample shows how to use checkbox control and handle its checked/unchecked events
    public partial class CheckBoxControlSample : Indicator
    {
        protected override void Initialize()
        {
            var stackPanel = new StackPanel
            {
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center,
                BackgroundColor = Color.Gold
            };

            var checkBox = new CheckBox
            {
                Text = "Unchecked",
                Margin = 10,
                FontWeight = FontWeight.ExtraBold
            };

            checkBox.Checked += CheckBox_Checked;
            checkBox.Unchecked += CheckBox_Unchecked;

            stackPanel.AddChild(checkBox);

            Chart.AddControl(stackPanel);
        }

        private void CheckBox_Unchecked(CheckBoxEventArgs obj)
        {
            obj.CheckBox.Text = "Unchecked";
        }

        private void CheckBox_Checked(CheckBoxEventArgs obj)
        {
            obj.CheckBox.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

        checkBox = CheckBox()
        checkBox.Text = "Unchecked"
        checkBox.Margin = Thickness(10)
        checkBox.FontWeight = FontWeight.ExtraBold

        checkBox.Checked += self.on_checkBox_checked
        checkBox.Unchecked += self.on_checkBox_unchecked

        stackPanel.AddChild(checkBox)

        api.Chart.AddControl(stackPanel)

    def on_checkBox_checked(self, args):
        args.CheckBox.Text = "Checked"

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

Constructors

Name Description
CheckBoxDesktopCLICloud Initializes a new instance of the checkbox class.

Properties

Name Description
ContentDesktopCLICloudControlBase Gets or sets the content.
IsCheckedDesktopCLICloudbool? Gets or sets a value indicating whether the checkbox is checked.
IsThreeStateDesktopCLICloudbool Checks if the checkbox may be of three states - checked, unchecked and indeterminate.
TextDesktopCLICloudstring Gets or sets the checkbox text.

Events

Name Description
CheckedDesktopCLICloudAction<CheckBoxEventArgs> Occurs when checked.
ClickDesktopCLICloudAction<CheckBoxEventArgs> Occurs when clicked.
IndeterminateDesktopCLICloudAction<CheckBoxEventArgs> Occurs when indeterminate.
UncheckedDesktopCLICloudAction<CheckBoxEventArgs> 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