Hello Zdenek,
Thank you for your question.
I just confirmed this behavior in Visual FoxPro 9.x
First off, please note that I am not a VFP developer, while I have been trying to find more low level details on VFP in this particular area, it seems not that easy to find. Probably due to how long the language has been retired by Microsoft.
My suspicion is that this problem is due to how Visual FoxPro deals with handling windows controls. Normally each control on a form has its own window and its own window handle plus a message loop in which the windows messages are being dispatched. As such each control is capable of handling the focus changes itself or delegate it to the parent object.
With VFP - from what I've understood - only the form is a real windows control and all the native VFP controls -such as the textbox control- are handled by the form and are bitmap presentations of what normally would be a native windows control.
AntView is a native Windows control and thus behaves like a native Windows control when added to a form in your application.
Sadly this sometimes appears to result in issues like the one you are seeing when using in Visual FoxPro. While that might be "the way Windows works" it is obviously unwanted in this respect. There's also a lot of controls that do not behave like this in VFP, so it clearly can be fixed. The question is what FoxPro expects the control to do. I very much want to have this addressed or at least be able to provide a proper workaround.
For navigating by keyboard via a tab/Shift-tab you should be able to set
NextFocusWindowHandle
And
PreviousFocusWindowHandle
Both properties take a window handle as parameter of the object that you want to take focus “Next” or “Previous”.
Eg. the following code worked for me to be able to tab out of the control.
Code:
thisform.oAntView.NextFocusWindowHandle = mainHwnd()
thisform.oAntView.PreviousFocusWindowHandle = mainHwnd()
Using that, you will notice that the focus will be given to the object that had the focus before AntView took the focus from the VFP form.
Also note that you can use the
MoveFocus method in VFP to assign the focus programmatically to the AntView control.
None of the above however does address your issue with the mouse!
Let me see if there's something I can find to alleviate this issue.
edited:
Edit Reason: With VFP you can use the normal NextFocusWindowHandle instead of the UInt variant, especially when using 64 bit that becomes more important.
--
Wil