Page 1 of 1

No Mouse events in SubChart

Posted: Tue Mar 30, 2010 10:47 pm
by 15655308
Hi Support,

I hope I'm missing something here!

I have a main chart which has an added SubChartTool in the main chart tool collection and a sub chart is added to the SubChartTool.

My problem is that the sub chart does not seem to get any mouse event (eg MouseMove or MouseDown) while the main chart does. For example, if I click on the main chart the main chart gets a MouseDown event (expected) where as if I click on a sub chart the main chart gets a MouseDown event and the sub chart does not. I would have expected at least both charts to get the mouse event but preferably only the chart which is clicked on.

Is this a defect or have I got something wrong?

BTW. My real problem is that a CursorTool was added to the sub chart but it would not follow the mouse movements in the sub chart. Hence the above comments and investigation into mouse events.

thanks
Mark

Re: No Mouse events in SubChart

Posted: Thu Apr 01, 2010 10:43 am
by yeray
Hi Mark,

Yes, the mouse events aren't fired in the SubChartTool charts. I've checked it for the Click, MouseDown, MouseUp and MouseMove events.
On the other hand, AfterDraw and Zoomed seem to work fine.

I've added it to the wish list to be implemented in future releases (TF02014771).

Anyway, you can move the cursor manually using the "parent" chart mouse events:

Code: Select all

        public Form1()
        {
            InitializeComponent();
            CreateChart();
            CreateSubChart();
            InitializeChart();
            InitializeSubChart();
        }

        private Steema.TeeChart.TChart tChart1; //Chart1
        private Steema.TeeChart.TChart tChart2; //SubChart - Chart2
        private Steema.TeeChart.Commander chartController1;
        private Steema.TeeChart.Tools.CursorTool cursor1;
        private Boolean DragCursor;

        private void CreateChart()
        {
            tChart1 = new Steema.TeeChart.TChart();
            this.Controls.Add(tChart1);

            chartController1 = new Steema.TeeChart.Commander();
            this.Controls.Add(chartController1);
            chartController1.Chart = tChart1;

            tChart1.Dock = DockStyle.Fill;
        }

        private void CreateSubChart()
        {
            Steema.TeeChart.Tools.SubChartTool subchart1 = new Steema.TeeChart.Tools.SubChartTool(tChart1.Chart);
            tChart2 = subchart1.Charts.AddChart("Chart2");

            tChart2.Width = tChart1.Width / 2;
            tChart2.Height= tChart1.Height / 2;
        }
        
        private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;

            new Steema.TeeChart.Styles.Points(tChart1.Chart);
            tChart1[0].FillSampleValues(5);

            tChart1.MouseDown += new MouseEventHandler(tChart1_MouseDown);
            tChart1.MouseUp += new MouseEventHandler(tChart1_MouseUp);
            tChart1.MouseMove += new MouseEventHandler(tChart1_MouseMove);
        }

        private void InitializeSubChart()
        {
            tChart2.Aspect.View3D = false;

            new Steema.TeeChart.Styles.Line(tChart2.Chart);
            tChart2[0].FillSampleValues(5);

            cursor1 = new Steema.TeeChart.Tools.CursorTool(tChart2.Chart);
            cursor1.Style = Steema.TeeChart.Tools.CursorToolStyles.Vertical;
            cursor1.Pen.Color = Color.Green;
            tChart1.Draw();
            cursor1.XValue = 2;

            DragCursor = false;
        }

        void tChart1_MouseDown(object sender, MouseEventArgs e)
        {
            if (cursor1.Clicked(e.X,e.Y) == Steema.TeeChart.Tools.CursorClicked.Vertical)
                DragCursor = true;
        }

        void tChart1_MouseUp(object sender, MouseEventArgs e)
        {
            DragCursor = false;
        }

        void tChart1_MouseMove(object sender, MouseEventArgs e)
        {
            if (DragCursor)
                cursor1.XValue = cursor1.GetHorizAxis.CalcPosPoint(e.X);
        }

Re: No Mouse events in SubChart

Posted: Wed Apr 28, 2010 10:37 pm
by 15655308
Hi Yeray,

In the release notes for the latest release 4.0.2010.13050 I note that this defect [TF02014771] has not been fixed. This is disappointing. In fact there was very little in the release to encourage me to update our custom build of TChart

Would it be possible to issue me with a private fix for this defect?

regards
Mark

Re: No Mouse events in SubChart

Posted: Thu Apr 29, 2010 8:56 am
by narcis
Hi Mark,

We will work to identify a solution to this problem and can send you pre-release code for testing when available.

Re: No Mouse events in SubChart

Posted: Fri Apr 30, 2010 4:34 am
by 15655308
Hi Narcis,

great! I (and our customer) will look forward to getting it.

regards
Mark

Re: No Mouse events in SubChart

Posted: Tue May 04, 2010 9:01 am
by yeray
Hi Mark,

I've just sent you a mail to your registered mail with the fix for the OnMouseMove, OnMouseDown and OnMouseUp events in the SubChartTool (TF02014771).

Re: No Mouse events in SubChart

Posted: Mon May 17, 2010 9:13 pm
by 15655308
Hi Yeray,

sorry for the delay I've been involved with other work.

I don't appear to have the email would you mind sending it again. Thankyou.

regards
Mark

Re: No Mouse events in SubChart

Posted: Tue May 18, 2010 12:21 pm
by yeray
Hi Mark,

I sent it to your partner Luke, that is the registered mail into this forum.
I think I found your mail. Could you please check it again?

Re: No Mouse events in SubChart

Posted: Wed May 19, 2010 1:40 am
by 15655308
Hi Yeray,

got it. Thanks.

I will post back when I have had a chance to use the code.

regards
Mark