Drawing Object can't be locked programatically

Created at 24 May 2024, 18:42
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

Drawing Object can't be locked programatically
24 May 2024, 18:42


Hello cTrader Support Team,

This problem has been tested via the below code(To select an object to Lock or Unlock it) in all versions 4.8, 4.9, 5.0.21.

The problem is when you select a Drawing object, it will go somewhere but can't be seen in the chart, And it is still listed in the Object Manager window.

 

using System;
using System.Linq;
using cAlgo.API;


namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class EditIconTest : Indicator
    {
        [Parameter("Debug...", DefaultValue = "", Group = "Ver" )] public string DebugMsg  { get; set; }

        protected override void Initialize()
        { Chart.ObjectsSelectionChanged += Chart_ObjectsSelectionChanged; }

        public override void Calculate(int index) { }
        
        private void Chart_ObjectsSelectionChanged(ChartObjectsSelectionChangedEventArgs obj)
        {
            if      ( Chart.SelectedObjects.Count == 0 ) {                                                                          }
            else if ( Chart.SelectedObjects.Count == 1 ) { Chart.SelectedObjects[0].IsLocked = !Chart.SelectedObjects[0].IsLocked;  }
            else if ( Chart.SelectedObjects.Count >= 2 ) {                                                                          }

        }
        
     }

}

@Capt.Z-Fort.Builder
Replies

PanagiotisCharalampous
29 May 2024, 05:18

Hi there, 

Unfortunately we were not able to reproduce this problem. Can you please record a video demonstrating this happening?

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
29 May 2024, 05:20

Hi there,

Unfortunately we were not able to reproduce this issue. Can you please record a video demonstrating this issue?

Best regards,

Panagiotis


@PanagiotisCharalampous

Capt.Z-Fort.Builder
30 May 2024, 17:49 ( Updated at: 31 May 2024, 05:27 )

RE: Drawing Object can't be locked programatically

PanagiotisCharalampous said: 

Hi there, 

Unfortunately we were not able to reproduce this problem. Can you please record a video demonstrating this happening?

Best regards,

Panagiotis

Here is the video I took, it's not professional looking, please volume up your speaker as my mic works poorly.

Basically, the code should (un)lock the object when it is selected. It works fine on the rectangle and others, but not on Drawing objects.  

The drawing objects just disappeared, and not possible to be found or seen on the chart anymore.  However, it is still listed in the Object Manager window.

Hopefully, this explains. 

Thanks for any advice or possible fixes.


@Capt.Z-Fort.Builder