doubleclick loads VB6 form - no mouse focus

  • Thread starter Thread starter matt tagliaferri
  • Start date Start date
M

matt tagliaferri

I'm calling VB6 forms from my new .NET project so I can upgrade my
code in phases and not have to rewrite it all in one shot.

I've wrapped the VB6 form calls inside of ActiveX DLL classes, and
then reference the DLL in my .NET project and can display the VB6
forms.

This works fine unless I try to do it from any DoubleClick event in
..NET. When I do this, the form displays and has keyboard focus (I can
tab from control to control), but no mouse focus, unless I click on
the form once. For example, if I load the form and click immediately
on the Close button, the button doesn't click unless I do it twice
(once to bring focus to the form, once to click the button). Same
thing with dragging the window to a new location - the first drag
doesn't work, it acts to bring focus to the VB6 form.

If I load the same VB6 form from a click event instead of a
doubleclick event, focus is given to the form correctly.

any ideas?
matt tag
 
This could be because the DoubleClick event happens when you press the mouse
button, whereas the Click event happens when you release the mouse button.

So after your .NET form receives the DoubleClick event, it's then receiving
a MouseUp (and possibly a Click too - haven't checked this) event. It's
possible that something in that MouseUp event (whether code you've written,
or code in the framework) is causing your problems.

Instead of showing the VB6 form from your DoubleClick event, try showing the
form from your MouseUp event (setting a flag in DoubleClick, checking for
and clearing that flag in MouseUp) and see if that helps.
 
Joe White said:
Instead of showing the VB6 form from your DoubleClick event, try showing the
form from your MouseUp event (setting a flag in DoubleClick, checking for
and clearing that flag in MouseUp) and see if that helps.

Thanks, this didn't work. I was able to solve the problem by creating
a timer in the double-click event, then showing the modal VB6 form in
the timer tick event (and also disabling the timer, making it a "one
tick only" thingy.

cheesy, but functional.

matt tag
 
Back
Top