Style set FontFamily doesn't work on TextBox

Created at 01 Jun 2024, 13:35
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
Capt.Z-Fort.Builder's avatar

Capt.Z-Fort.Builder

Joined 03.06.2020

Style set FontFamily doesn't work on TextBox
01 Jun 2024, 13:35


Hello,

In my indicator, I found a bug that Style.set(ControlProperty.FontFamily, )  doesn't work on TextBox.

For example, 4 groups of textbox in the below indicator, the left 2 group FontFamily works well, as they don't use style.
the right 2 group FontFamily use the style set FontFamily, but it doesn't work.

Just found this issue, and reported it.  Thanks.

using System;
using cAlgo.API;

namespace cAlgo
{
    [Indicator(IsOverlay = true, AccessRights = AccessRights.None)]
    public class TestStyle : Indicator
    {
        private Canvas  canvas = new () { Height=600, Width=600, HorizontalAlignment=HorizontalAlignment.Center,
                                          BackgroundColor=Color.Black, VerticalAlignment=VerticalAlignment.Center };
        private TextBox txb_US, txb_EU, txb_GB, txb_CH;

        protected override void Initialize()
        {
            Style st_CWtxb = new();
            st_CWtxb.Set(ControlProperty.FontFamily, "Times New Roman");
            st_CWtxb.Set(ControlProperty.Height,  60);  st_CWtxb.Set(ControlProperty.Width, 150);
            st_CWtxb.Set(ControlProperty.FontSize,30);  st_CWtxb.Set(ControlProperty.FontWeight, FontWeight.DemiBold);
            st_CWtxb.Set(ControlProperty.HorizontalContentAlignment, HorizontalAlignment.Center);  
            st_CWtxb.Set(ControlProperty.VerticalContentAlignment,   VerticalAlignment.Center  );
            
            txb_US = new () { Style = st_CWtxb, FontFamily="Times New Roman", Top = 100, Left = 150, Text = "USD GBP", ForegroundColor = Color.Red,    };
            txb_EU = new () { Style = st_CWtxb, FontFamily="Times New Roman", Top = 200, Left = 150, Text = "EUR CHF", ForegroundColor = Color.Blue,   };
            txb_GB = new () { Style = st_CWtxb,                               Top = 100, Left = 350, Text = "USD GBP", ForegroundColor = Color.Purple, };
            txb_CH = new () { Style = st_CWtxb,                               Top = 200, Left = 350, Text = "EUR CHF", ForegroundColor = Color.Yellow, };
            
            canvas.AddChild(txb_US);  
            canvas.AddChild(txb_EU); 
            canvas.AddChild(txb_GB); 
            canvas.AddChild(txb_CH);
            Chart.AddControl(canvas);
        }

        public override void Calculate(int index) {}
    }
}

@Capt.Z-Fort.Builder
Replies

PanagiotisCharalampous
03 Jun 2024, 10:09

Hi there,

Thanks for reporting this issue. We managed to reproduce it and we will fix in an upcoming update.

Best regards,

Panagiotis


@PanagiotisCharalampous