Skip to content

AspBlock

interface cAlgo.API

DesktopCLICloud

Represents an active symbol panel block.

Environment behaviour

CLI — not supported. Available to plugins only, and plugins cannot run in the CLI.

Cloud — not supported. Available to plugins only, and plugins cannot run in the cloud.

Definition

public interface AspBlock

Namespace: cAlgo.API · Group: Asp

Examples

using cAlgo.API;

namespace cAlgo.Plugins
{
    public partial class Test : Plugin
    {
        protected override void OnStart()
        {
            var aspSymbolTabBlock = Asp.SymbolTab.AddBlock("Test Block");

            var panel = new StackPanel {Orientation = Orientation.Vertical};

            var webView = new WebView() {Height = 250};

            webView.Loaded += args => webView.NavigateAsync("https://ctrader.com/");

            panel.AddChild(webView);

            var removeBlockButton = new Button {Text = "Remove Block"};

            removeBlockButton.Click += args => Asp.SymbolTab.RemoveBlock(aspSymbolTabBlock);

            panel.AddChild(removeBlockButton);

            aspSymbolTabBlock.Child = panel;

            aspSymbolTabBlock.Height = 300;

            aspSymbolTabBlock.DetachedWindow.Width = 400;
            aspSymbolTabBlock.DetachedWindow.Height = 350;

            aspSymbolTabBlock.Detached += args => Print("Block detached");
            aspSymbolTabBlock.Attached += args => Print("Block attached");
            aspSymbolTabBlock.Updated += args => Print("Block updated");
        }
    }
}
import clr
clr.AddReference("cAlgo.API")

from cAlgo.API import *

class Test():
    def on_start(self):
        aspSymbolTabBlock = api.Asp.SymbolTab.AddBlock("Test Block")

        panel = StackPanel()
        panel.Orientation = Orientation.Vertical

        webView = WebView()
        webView.Height = 250
        webView.Loaded += lambda _: webView.NavigateAsync("https://ctrader.com/")

        panel.AddChild(webView)

        removeBlockButton = Button()
        removeBlockButton.Text = "Remove Block"
        removeBlockButton.Click += lambda _: api.Asp.SymbolTab.RemoveBlock(aspSymbolTabBlock)

        panel.AddChild(removeBlockButton)

        aspSymbolTabBlock.Child = panel
        aspSymbolTabBlock.Height = 300
        aspSymbolTabBlock.DetachedWindow.Width = 400
        aspSymbolTabBlock.DetachedWindow.Height = 350

        aspSymbolTabBlock.Detached += lambda _: print("Block detached")
        aspSymbolTabBlock.Attached += lambda _: print("Block attached")
        aspSymbolTabBlock.Updated += lambda _: print("Block updated")
{
  "AccessRights": "None"
}

Properties

Name Description
ChildDesktopCLICloudControlBase Get / set content of current block.
DetachedWindowDesktopCLICloudDetachedWindow Returns detached window properties.
HeightDesktopCLIClouddouble Get / set height of current block (default is 200).
IdDesktopCLICloudstring Returns unique ID of the current block.
IndexDesktopCLICloudint Get index of current block.
IsAttachedDesktopCLICloudbool Get / set block attached / detached state.
IsDetachableDesktopCLICloudbool Get / set block detachability, if True user can attach or detach the block.
IsExpandedDesktopCLICloudbool Get expanded state of current block.
TitleDesktopCLICloudstring Returns title of the current block.

Events

Name Description
AttachedDesktopCLICloudAction<AspBlockAttachedEventArgs> Occurs when block attached.
DetachedDesktopCLICloudAction<AspBlockDetachedEventArgs> Occurs when block is detached.
UpdatedDesktopCLICloudAction<AspBlockUpdatedEventArgs> Occurs when block is updated.

See also