Microsoft KB Archive/161148

= PRB: ActiveX Control Click Event Not Firing When Form Is Modal =

Article ID: 161148

Article Last Modified on 12/3/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 3.0b Standard Edition
 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q161148



SYMPTOMS
When using ActiveX controls on a modal form in Visual FoxPro 5.0, the Click event does not fire if that form has been called from an ActiveX control on another form. This also applies to Threed controls used on a form in Visual FoxPro 3.0.



RESOLUTION
Change the second form's WindowType to Modeless or call the second form with a standard FoxPro control on the first form.



STATUS
Microsoft is researching this behavior and will post new information here in the Microsoft Knowledge Base as it becomes available.



MORE INFORMATION
When adding code to the Click event of an ActiveX or Threed control, normally the code in the Click event fires when that control is clicked regardless if the form is a modeless or modal form. If that form is modal and called from a ActiveX or Threed control on another form, then the code in the Click event of that ActiveX or Threed control does not fire. For the code to fire correctly, the form that is called has to be modeless or the control that calls the form with the ActiveX or Threed control has to be a standard FoxPro control.

Steps to Reproduce Behavior
When using Visual FoxPro 3.0, substitute the phrase "Threed control" for "ActiveX control" in the following steps:

 Create two forms called Active1 and Active2, respectively, and add an ActiveX control (the Threed Command button will do) to each form.  In the Active2 form change the WindowType property to Modal and add the following code to the Click event of the ActiveX control: WAIT WINDOW "ActiveX Control"   In the Active1 form add a FoxPro command button and add the following code to the Click event of the ActiveX control and the Click event of the Visual FoxPro command button: DO FORM Active2  Run the Active1 form and click on the ActiveX control. When the Active2 form appears, note that clicking on its ActiveX control does not fire the WAIT WINDOW command. Close the Active2 form and click on the standard command button on the Active1 form. Note that the WAIT WINDOW command fires when clicking the ActiveX control on the second form. Close the Active2 form, modify the form, and change the WindowType property in the Active2 form to modeless. Note that when the Active2 form is called from the ActiveX control on the Active1 form, the code fires properly when clicking on the ActiveX control on the Active2 form.</li></ol>

Additional query words: ActiveX kbdse vfoxwin

Keywords: KB161148

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.