We are using the MS interop toolkit (2.0a) to help migrate our application from VB6 to .NET. We are creating user controls that essentially provide the entire functionality of a form and they are hosted within VB6 midi child forms. The user controls host a variety of controls including the NetAdvantage Ultragrid and others. We are using 2007 V3.
This is working fine for the most part, however, we have one issue that we cannot resolve. If a user clicks a popup menu the popup does not automatically dismiss if the toolbar looses focus. You can click on another control on the user control, outside of the form, even drag or close the form and the popup does not dismiss. Setting the host toolbar's visibility to false does not cause the popup to dismiss/disappear either.
This does not happen with the MS-supplied toolbar controls.
Any help in figuring out how to resolve this would be greatly appreciated.
Dana
This is most likely related to the fact that your top-level control is not a managed .NET Form. Therefore, the popup control cannot hook the Deactivate event of the Form to know when to hide itself. I would recommend submitting the issue ot the support group: http://es.infragistics.com/gethelp. We may be able to find a workaround using unmanaged windows APIs. If not, we may be able to indicate how to work around this manually.
Thanks, will do.
dana
After working with the Infragistics support team, a solution to this problem has been found. It appears the .NET message filter does work here when an unmanaged form is active. This is probably because the .NET framework does not have control of the message pump.
To avoid the issue, make a call to the following method: Infragistics.Win.Utilities.ForceNativeMessageFilter() at the start of your application.
We added this the our user control base class and the problem immediately went away without any detectable side affects.
I cannot say enough about the level of help these support team provided in tracking this issue down. We are now able to seamlessly integrate .net user controls hosting the Infragistics toolbar controls and others into out VB6 application. This allows us to migrate the user interface of large commercial application rather then doing the extended development effort which would be required to re-write the entire thing.
Thanks again,
This wasn't mentioned in the bug notes, but it should have been: the ForceNativeMessageFilter() call will only perform the fix on the thread it was called on. If the application is multi-threaded, placing this call in the start of the application is incorrect. I would instead recommend placing the call in the constructor of the user control hosting the toolbars manager. This will not be a problem if multiple user controls are created through the life of the application because ForceNativeMessageFilter() can safely be called multiple times on the same thread and does not cause a significant performance decrease when called more than once.
That is good information, thanks. What we did in our implementation was to place the call in an initialization method of the base class that all our interop user controls inherit to ensure that the ForceNativeMessageFilter() call was made. That way the method was called no matter what.