Page 1 of 1

How do you disable Right Mouse button

Posted: Tue Feb 26, 2008 10:40 pm
by 8739068
I created a simple example where I dropped a TeeChart control onto a form

I dropped a Chart Controller control onto the form and assigned the Chart propert to tChart1.

Added a button and added an event to handle the button click event that looked like this

private void button1_Click(object sender, EventArgs e)
{
tChart1.Panning.MouseButton = MouseButtons.None;
tChart1.Zoom.MouseButton = MouseButtons.Left;
}

When I ran the program I opened the chart editor and added a line series to the chart and filled it with some sample points by going to Series | DataSource and selecting Random and pressed apply

I then went to the 3D tab for the chart and unchecked the 3D checkbox.

Closed the Chart Editor

I pressed the button to execute the code in the button click event

I then went back the chart and right clicked on the chart and dragged the mouse. The right click button was still moving the chart around. This also made the chart go from a 2D flat view to 3D view of the chart.

How can I prevent the right mouse from doing anything with the chart? I don't want it to move the chart and I especially don't want the chart to go from 2D to 3D.

In the future, I will create right click menus so I will need to have the mouse right click available to me.

Posted: Wed Feb 27, 2008 11:41 am
by narcis
Hi Mike,

I have been able to reproduce the issue here and added it (TF02012850) to our defect list to be fixed for future releases.

Has there been any progress on this issue

Posted: Tue Jul 22, 2008 4:05 pm
by 8739068
This is an issue that continues to affect our application. Has there been any work on this issue or any planning on when this might be fixed?

The release notes from:

Release Notes April 4th 2008
TeeChart.NET version 3
Build 3.2.3016.15522
Compiled for Visual Studio 2008
Build 3.2.3016.15521
Compiled in .NET Framework 2.0

states

11) [TF02012850]
ChartController's Normal button
unchecked when Chart Editor button
clicked. Fixed.

TF02012850 item does not seem to be the same issue as documented in this thread. The right mouse button can still be dragged over a 2D chart and the chart will change to 3D mode.

Can someone please review?

Posted: Wed Jul 23, 2008 7:18 am
by narcis
Hi Mike,

I've just rechecked what you reported and I'm not able to reproduce the issue here using latest release available at the client area. Could you please try using it and check that your project's TeeChart.dll reference has been properly updated?

Thanks in advance.

Able to reproduce in my app

Posted: Thu Jul 24, 2008 7:51 pm
by 8739068
I am using version
TeeChart.NET version 3
Build 3.2.3016.15522
April 4th 2008

I was unable to reproduce the issue in my simple test application using the latest version released of the source code. I made sure I was using the same version in the my test application as the one in production application.

For some reason in my production application I see the problem. Just to reiterate, the problem is using the right mouse button, I click and drag and the chart moves. Is it possible to investigate what circumstances this issue might occur?

In my production application, I am setting
Tchart.Aspect.View3D = false
Tchart.Panning.MouseButton = MouseButtons.None;
Tchart.Zoom.MouseButton = MouseButtons.Left;

Yet when I use the right mouse button in my production application, I get a behavior similar to "Move" operation (which we do not use). What I mean is when you press the Move Button on the Chart Controller and then using the left mouse button you can drag the entire chart around the drawing surface.

I have examined the source code and I am finding it difficult to follow how mouse down events are being translated into pan, zoom, move operations.

Any ideas how I can insure that the right mouse click and drag will not result in a move operation?

Note: When you have a 2D chart being displayed and us use the Move operation via the Chart Controller, the chart will change from 2D to 3D. I think that might be a bug. I could easily demonstrate this with a simple chart, chart controller, and a line series.

Posted: Mon Jul 28, 2008 8:38 am
by narcis
Hi Mike,

First of all please notice that latest version available is 3.5.3105.20150/1/2 from the second of July. Could you please check if this version solves the problem at your end?

As you already pointed, TF02012850 was fixed for the 4th April release so this makes me wonder if you upgraded your project correctly.

If the problem persists please send us a simple example project we can run "as-is" to reproduce the problem here.

You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Thanks in advance.

Unable to create simple example

Posted: Tue May 26, 2009 9:18 pm
by 8739068
I am unable to create a simple example to send to you.

I add the TeeChart project to our solution and I am able to break in the ChartController.DoMove(int, int) method.

Here is a call stack

TeeChart.dll!Steema.TeeChart.ChartController.DoMove(int X = 194, int Y = 117) Line 565 C#
TeeChart.dll!Steema.TeeChart.ChartController.DoMouseMove(int X = 194, int Y = 117, System.Windows.Forms.Keys Shift = None) Line 468 + 0x22 bytes C#
TeeChart.dll!Steema.TeeChart.ChartController.TeeEvent(Steema.TeeChart.TeeEvent e = {Steema.TeeChart.TeeMouseEvent}) Line 398 + 0x2e bytes C#
TeeChart.dll!Steema.TeeChart.Chart.BroadcastEvent(Steema.TeeChart.TeeEvent Event = {Steema.TeeChart.TeeMouseEvent}) Line 1458 + 0xc bytes C#
TeeChart.dll!Steema.TeeChart.Chart.BroadcastMouseEvent(Steema.TeeChart.MouseEventKinds kind = Move, System.Windows.Forms.MouseEventArgs e = {X = 194 Y = 117 Button = Right}, System.Windows.Forms.Keys modKeys = None, ref System.Windows.Forms.Cursor c = {[Cursor: Cross]}) Line 1339 + 0xb bytes C#
> TeeChart.dll!Steema.TeeChart.TChart.OnMouseMove(System.Windows.Forms.MouseEventArgs e = {X = 194 Y = 117 Button = Right}) Line 1381 + 0x29 bytes C#
System.Windows.Forms.dll!System.Windows.Forms.Control.WmMouseMove(ref System.Windows.Forms.Message m) + 0x87 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) + 0x64d bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(ref System.Windows.Forms.Message m) + 0xd bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m) + 0x36 bytes
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr hWnd, int msg = 512, System.IntPtr wparam, System.IntPtr lparam) + 0x57 bytes
[Native to Managed Transition]
[Managed to Native Transition]
System.Windows.Forms.dll!System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(int dwComponentID, int reason = -1, int pvLoopData = 0) + 0x2f1 bytes
System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(int reason = -1, System.Windows.Forms.ApplicationContext context = {System.Windows.Forms.ApplicationContext}) + 0x17d bytes
System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoop(int reason, System.Windows.Forms.ApplicationContext context) + 0x53 bytes
System.Windows.Forms.dll!System.Windows.Forms.Application.Run(System.Windows.Forms.Form mainForm) + 0x2e bytes
SetBased.exe!TCPSM.Program.Main() Line 215 + 0xb bytes C#



It seems that there is not a way to set the mouse buttons like

TChart.Panning.MouseButton
TChart.Zoom.MouseButton

seems like there should be a similar property to set for Moving that would look like
TChart.Moving.MouseButton

How could I set the mouse button used for moving? I would think I would want to set it MouseButtons.None

Posted: Wed May 27, 2009 12:09 pm
by narcis
Hi Mike,

I'm not sure about what you are trying to achieve here but using TeeChart mouse events you can control with which mouse button do you want them to perform any action, for example:

Code: Select all

		void tChart1_MouseMove(object sender, MouseEventArgs e)
		{
			if (e.Button == MouseButtons.Middle)
			{
				//Do something
			}
		}

Just trying to prevent Moving

Posted: Wed May 27, 2009 1:49 pm
by 8739068
Like this thread has indicated, somehow in our application the user is able to right click and drag the chart around. I verified that the ChartController.DoMove(int, int) method is getting called when this happens. The chart which was in 2D goes to 3D and the chart is moved. This is very undesirable behavior.

The mystery is how the chart is allowed to process the right mouse click as a move. I never intentionally put the mouse buttons in that mode. It seems that Move mode is handled very differently than panning or zooming. Why is there not way to do something like the following

Code: Select all

TChart.Moving.MouseButton = MouseButtons.None
I have uploaded a video to help explain what I am seeing. Please see my flash video in ChartMove.swf.zip

Posted: Wed May 27, 2009 2:54 pm
by narcis
Hi Mike,

Thanks for the video. I understand which is the problem. However, by default the commander button which is enabled if the left-most one, not the chart move button. Here's something similar to its implementation:

http://www.teechart.net/support/viewtopic.php?t=6120

Could you please send us a simple example project we can run "as-is" to reproduce the problem?

Thanks in advance.

I think I solved the problem

Posted: Wed May 27, 2009 3:03 pm
by 8739068
Since we have the source code I rewrote the ChartController.DoMouseMove method. We don't need the right mouse button to operate on the chart so I changed this method

Old code

Code: Select all

		private void DoMouseMove(int X, int Y, Keys Shift)
		{
			if (dragging)
			{
				dragging = false;
				if (IsButtonDown(bNormal)) DoNormal(X, Y);  
				else
					if (mouseButtons == MouseButtons.Right) DoMove(X, Y);
					else
					{
						if (IsButtonDown(bRotate))
						{
							if (Shift == Keys.Shift) DoZoom(X, Y);
							else DoRotate(X, Y);
						}
						else if (IsButtonDown(bMove))
						{
							if (Shift == Keys.Shift) DoZoom(X, Y);
							else DoMove(X, Y);
						}
						else if (IsButtonDown(bZoom))
						{
							DoZoom(X, Y);
						}
						else if (IsButtonDown(bDepth))
						{
							DoDepth(X, Y);
						}
					}
				if (labelValues) ShowValues();
				dragging = true;
			}
		}
New code

Code: Select all

private void DoMouseMove(int X, int Y, Keys Shift)
		{
			if (dragging && (mouseButtons != MouseButtons.Right))
			{
				dragging = false;
				if (IsButtonDown(bNormal)) DoNormal(X, Y);  
				else                         
                    if (IsButtonDown(bRotate))
                    {
                        if (Shift == Keys.Shift) DoZoom(X, Y);
                        else DoRotate(X, Y);
                    }
                    else if (IsButtonDown(bMove))
                    {
                        if (Shift == Keys.Shift) DoZoom(X, Y);
                        else DoMove(X, Y);
                    }
                    else if (IsButtonDown(bZoom))
                    {
                        DoZoom(X, Y);
                    }
                    else if (IsButtonDown(bDepth))
                    {
                        DoDepth(X, Y);
                    }

				if (labelValues) ShowValues();
				dragging = true;
			}
		}