I think that this is something new in 8.2 but not 100% positive. I have a windows form as a tab in a mdi tab control. The form has a UltraWinChart in the top of the for and a Grid with associated chart data on the bottom. I've implemented a drill down system so the if the user double clicks on a graph bar a new mdi tab form is generated with the graph and associated data for the selected bar.
What I'm seeing after upgrading to 8.2 is the following
1) Double click on the graph bar you want
2) The new form and tab are created and activated with the new graph showing
3) Immediatly another tab TabSelecting/TabActivated set of events and the active tab is changed back to the tab with the original chart.
So I get
Tab1 --> Double click --> Tab2 (initialized/selecting/activated) --> Tab1 (selecting/activated).
It appears as though the double click event is fired and then the event (some event) is left over and fired on the original tab (Tab1 in my example) forcing that tab to be reactivated.
I have other user events where they can run the same chart creation set of code to get the same new tab/new graph (like double clicking on the associated grid row or using a right click context menu path to generate the tab/graph andI do not see the same problem when getting there that way so I believe that this is an issue with the chart control in 8.2.
Is there any way to suppress this mouse event (assuming that my diagnosis is correct or course), or any other way to stop this very annoying behavior?
Just a couple of other notes. I also tried to hack this by setting a flag to suppress tab switching that the mdiManager_TabSelecting event looks at and if (true) sets the event e.Cancel property to true. This does not have any effect as the tab switches anyway (not sure why the cancel flag is ignored in this case). Also, looking at the stack trace for when I get this second ("bogus") tab selecting event it has the following (if that is helpful to anyone). From this it appears as though there is another mouse click event being sent to the WinChart control on the associated with the original chart (in this case the "Tasting Results" tab that is causing the problem.
> TastingMaster.exe!TastingMaster.TastingControlForm.mdiManager_TabSelecting(object sender = { [Infragistics.Win.UltraWinTabbedMdi.UltraTabbedMdiManager]}, Infragistics.Win.UltraWinTabbedMdi.CancelableMdiTabEventArgs e = {Infragistics.Win.UltraWinTabbedMdi.CancelableMdiTabEventArgs}) Line 318 C#
Infragistics2.Win.UltraWinTabbedMdi.v8.2.dll!Infragistics.Win.UltraWinTabbedMdi.UltraTabbedMdiManager.OnTabSelecting(Infragistics.Win.UltraWinTabbedMdi.CancelableMdiTabEventArgs e) + 0x6d bytes Infragistics2.Win.UltraWinTabbedMdi.v8.2.dll!Infragistics.Win.UltraWinTabbedMdi.UltraTabbedMdiManager.InvokeEvent(Infragistics.Win.UltraWinTabbedMdi.TabbedMdiEventIds eventId = TabSelecting, System.EventArgs e) + 0x28b bytes Infragistics2.Win.UltraWinTabbedMdi.v8.2.dll!Infragistics.Win.UltraWinTabbedMdi.UltraTabbedMdiManager.ActivateMdiChild(Infragistics.Win.UltraWinTabbedMdi.MdiTab tab = {MdiTab Text='Tasting Results'}, bool invokeTabSelecting, bool invokeTabSelected = true, bool allowCancel = false, bool activate = true) + 0x80 bytes
Infragistics2.Win.UltraWinTabbedMdi.v8.2.dll!Infragistics.Win.UltraWinTabbedMdi.MdiTab.OnMdiChildEnter(object sender, System.EventArgs e) + 0x85 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.OnEnter(System.EventArgs e) + 0x62 bytes System.Windows.Forms.dll!System.Windows.Forms.Form.OnEnter(System.EventArgs e) + 0xb bytes System.Windows.Forms.dll!System.Windows.Forms.Control.NotifyEnter() + 0x1d bytes System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.UpdateFocusedControl() + 0xb8 bytes System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.AssignActiveControlInternal(System.Windows.Forms.Control value = {TastingMaster.TastingResultsTable, Text: Tasting Results}) + 0x4a bytes System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.ActivateControlInternal(System.Windows.Forms.Control control, bool originator = false) + 0x4a bytes System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.ActivateControlInternal(System.Windows.Forms.Control control = {System.Windows.Forms.SplitContainer}, bool originator = false) + 0xaf bytes
System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.ActivateControlInternal(System.Windows.Forms.Control control = {Infragistics.Win.UltraWinChart.UltraChart}, bool originator = true) + 0xaf bytes System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.ActivateControlInternal(System.Windows.Forms.Control control) + 0x7 bytes
System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.WmSetFocus(ref System.Windows.Forms.Message m = {msg=0x7 (WM_SETFOCUS) hwnd=0x24a145e wparam=0x271888 lparam=0x0 result=0x0}) + 0xd5 bytes System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.WndProc(ref System.Windows.Forms.Message m) + 0x17 bytes System.Windows.Forms.dll!System.Windows.Forms.UserControl.WmSetFocus(ref System.Windows.Forms.Message m) + 0x92 bytes System.Windows.Forms.dll!System.Windows.Forms.UserControl.WndProc(ref System.Windows.Forms.Message m) + 0xd 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.Callback(System.IntPtr hWnd, int msg = 7, System.IntPtr wparam, System.IntPtr lparam) + 0x5a bytes [Native to Managed Transition] [Managed to Native Transition] System.Windows.Forms.dll!System.Windows.Forms.Control.FocusInternal() + 0x43 bytes System.Windows.Forms.dll!System.Windows.Forms.UserControl.OnMouseDown(System.Windows.Forms.MouseEventArgs e = {X = 172 Y = 86 Button = Left}) + 0x1b bytes Infragistics2.Win.UltraWinChart.v8.2.dll!Infragistics.Win.UltraWinChart.UltraChart.OnMouseDown(System.Windows.Forms.MouseEventArgs evt) + 0x88 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.WmMouseDown(ref System.Windows.Forms.Message m, System.Windows.Forms.MouseButtons button, int clicks) + 0xf1 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) + 0x4d3 bytes System.Windows.Forms.dll!System.Windows.Forms.ScrollableControl.WndProc(ref System.Windows.Forms.Message m) + 0x45 bytes System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.WndProc(ref System.Windows.Forms.Message m) + 0x11 bytes System.Windows.Forms.dll!System.Windows.Forms.UserControl.WndProc(ref System.Windows.Forms.Message m) + 0x13 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.Callback(System.IntPtr hWnd, int msg = 515, System.IntPtr wparam, System.IntPtr lparam) + 0x5a 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 TastingMaster.exe!TastingMaster.Program.Main() Line 45 + 0x1a bytes C# [Native to Managed Transition] [Managed to Native Transition] mscorlib.dll!System.AppDomain.ExecuteAssembly(string assemblyFile, System.Security.Policy.Evidence assemblySecurity, string[ args) + 0x39 bytes Microsoft.VisualStudio.HostingProcess.Utilities.dll!Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() + 0x2b bytes mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state) + 0x3b bytes mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x81 bytes mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() + 0x40 bytes
Neil
although your explanation is very detailed, it's very hard for me to understand what's going on due to the complexity of the scenario. A sample project would be very helpful...
But I do have one guess at a solution... try setting AcceptsFocus to False on the chart control.
failing that, you might try inheriting the chart, overriding OnMouseDown, and not calling base.OnMouseDown, as judging by the call stack that's the root of the problem.
Thanks for your reply however neither of these solutions will work (I don't think) since I do need the mouse doubleclick messages but not the extra ones. I submitted an incident (WiC2563) to support and got the "provide a sample project" response so gave that up.
The workaround that I came up with was to remove the ChartDataDoubleClicked event handler and instead using the MouseDoubleClick event handler and then using begininvoke with the original double click handler method as the delegate. This seems to allow enough time or whatever to flush the mouse messages from the message queue and then handle the double click event.