Microsoft KB Archive/138921

= PRB: Form's Visible Property Does Not Respect Modal WindowType =

Article ID: 138921

Article Last Modified on 2/11/2000

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition

-



This article was previously published under Q138921



SYMPTOMS
When using .visible to display a form having WindowType=1 (modal), the modal attributes are not applied to the form; you can click to move off the form, and program execution continues.



CAUSE
Setting the Visible property of the form does not apply modal attributes to the form.



WORKAROUND
Instead of using the Visible property of the form to display it, use the Show method. The Show method properly applies modal attributes to the form.



STATUS
This behavior is by design.



Code Sample to Reproduce Problem
* The following example uses DEFINE CLASS and CREATEOBJECT * to create two custom classes named FormChild and FormGrandChild from * the Visual FoxPro Form base class. ACLASS is used to create an  * array named gaNewarray containing the class names, which is   * then displayed.

CLEAR PUBLIC frmMyForm frmMyForm = CREATEOBJECT("FormGrandChild") frmMyForm.visible=.t.  * frmMyForm.show     && uncomment this for proper behavior WAIT WINDOW 'After calling the form' TIMEOUT 2

DEFINE CLASS FormChild AS FORM ENDDEFINE

DEFINE CLASS FormGrandChild AS FormChild Caption='Hi' Left  = 10 Top   = 10 Height = 54 Width = 99 WindowType = 1    && modal PROCEDURE Init THIS.AddObject("Cmd1", "MyCmdBtn") this.cmd1.left = (thisform.width - this.width) /2 this.cmd1.top = (thisform.height - this.height) /2 this.cmd1.visible = .t.         ENDPROC ENDDEFINE

DEFINE CLASS MyCmdBtn AS CommandButton Caption='Bye' && Caption on the Command button Left  = 10   && Command button column Top   = 10   && Command button row Height = 18  && Command button height Width = 60   && Command button height PROCEDURE Click THISFORM.Release CLEAR EVENTS ENDPROC ENDDEFINE

Keywords: kbprogramming kbprb KB138921

-

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

© Microsoft Corporation. All rights reserved.