Skip to content

DateTimePicker

class cAlgo.API Since 5.5

DesktopCLICloud

Represents the date time picker control.

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 DateTimePicker : ControlBase

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

Examples

using cAlgo.API;

namespace cAlgo.Robots;

public partial class TestExample : Robot
{
   protected override void OnStart()
   {
       var dateTimePicker = new DateTimePicker
       {
            Value = Server.Time,
            MaxValue = Server.Time.AddMonths(1),
            MinValue = Server.Time.AddMonths(-1)
       };

       dateTimePicker.ValueChanged += args => Print($"Date Time Picker value change to: {args.NewValue}");

       var changeValueButton = new Button {Text = "Change Value"};

       changeValueButton.Click += args => dateTimePicker.Value = Server.Time.AddDays(1);

       var panel = new StackPanel
       {
            Orientation = Orientation.Vertical,
            HorizontalAlignment = HorizontalAlignment.Center,
            VerticalAlignment = VerticalAlignment.Center
       };

       panel.AddChild(dateTimePicker);
       panel.AddChild(changeValueButton);

       Chart.AddControl(panel);
   }
}
import clr

clr.AddReference("cAlgo.API")

# Import cAlgo API types
from cAlgo.API import *
# Import trading wrapper functions
from robot_wrapper import *

class Test():
    def on_start(self):
        self.dateTimePicker = DateTimePicker()
        self.dateTimePicker.Value = api.Server.Time
        self.dateTimePicker.MaxValue = api.Server.Time.AddMonths(1)
        self.dateTimePicker.MinValue = api.Server.Time.AddMonths(-1)

        self.dateTimePicker.ValueChanged += lambda args: api.Print(f"Date Time Picker value change to: {args.NewValue}")

        changeValueButton = Button()
        changeValueButton.Text = "Change Value"
        changeValueButton.Click += self.on_change_value_button_clicked

        panel = StackPanel()
        panel.Orientation = Orientation.Vertical
        panel.HorizontalAlignment = HorizontalAlignment.Center
        panel.VerticalAlignment = VerticalAlignment.Center

        panel.AddChild(self.dateTimePicker)
        panel.AddChild(changeValueButton)

        api.Chart.AddControl(panel)

    def on_change_value_button_clicked(self, args):
        self.dateTimePicker.Value = api.Server.Time.AddDays(1)
{
  "AccessRights": "None"
}

Constructors

Name Description
DateTimePickerDesktopCLICloud Initializes a new instance of the DateTimePicker class.

Properties

Name Description
MaxValueDesktopCLICloudDateTime Gets or sets maximum value.
MinValueDesktopCLICloudDateTime Gets or sets minimum value.
ShowTimeInputDesktopCLICloudbool Gets or sets whether show time picker input or not.
ValueDesktopCLICloudDateTime Gets or sets value.

Events

Name Description
ValueChangedDesktopCLICloudAction<DateTimePickerValueChangedEventArgs> Occurs when value is changed.

Inherited members

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