Page 1 of 1

How to identifty the mouse button in ClickPointer event?

Posted: Tue Mar 21, 2006 6:18 am
by 9788742
I am listening to ClickPointer pointer event of the line series.

The thing is this event gets fired when clicked with left mouse button as well as right mouse button,
So how do I find out whether the mouse button pressed was left or right?

I tried using click event of series to identify the mouse button (by keeping a boolean to indicate if the left mouse button was pressed).
But the problem is when the user clicks on the exact point (pointer) directly ClickPointer event is fired (Click event is not fired) and hence I am unable to identify the mouse button pressed.

Any ideas on how to achieve this?

Thanks

Posted: Wed Mar 22, 2006 9:31 am
by narcis
Hi Lakshmi,

You can get the mouse button clicked using TeeChart's MouseDown event an some code like this:

Code: Select all

    private void line1_ClickPointer(Steema.TeeChart.Styles.CustomPoint series, int valueIndex, int x, int y)
    {
      if (mb==MouseButtons.Left)
      {
        //Put your code here.  
      }
    }

    private MouseButtons mb;

    private void tChart1_MouseDown(object sender, MouseEventArgs e)
    {
      mb = e.Button;
    }

How to identifty the mouse button in ClickPointer event?

Posted: Wed Mar 22, 2006 12:03 pm
by 9788742
Thanks Narcis,

Instead I coded something like below:
if (TChart.MouseButtons == MouseButtons.Left)
{
...code goes here
}

Let me know your comments on the same.

One more question:
If I only subscribe for line.ClickPointer event, on clicking of the pointer on the line my code (function) does not get called.

But along with ClickPointer event, if I subscribe also for line.Click event (just provide a empty function to listen to this event), only then the clickpointer code of mine gets called.

Any comments on this behaviour?

Thanks.

Posted: Wed Mar 22, 2006 12:27 pm
by narcis
Hi Lakshmi,

Yes, that's right and this is as designed as ClickPointer event depends on the series Click event.