DOCERR: ControlBox Property Not Available at Run Time Per Help (143064)



The information in this article applies to:

  • Microsoft Visual FoxPro for Windows 3.0
  • Microsoft Visual FoxPro for Windows 3.0b

This article was previously published under Q143064

SUMMARY

The Visual FoxPro Help file topic for the ControlBox property of a form or toolbar says that the ControlBox property is available at design time and read-only at run time. This is incorrect; the ControlBox property is available at design time and at run time.

MORE INFORMATION

The ControlBox property can be changed to true (.T.) or false (.F.). The default value is true, which displays the minus sign in Windows 3.1 and Windows NT or an icon in Windows 95 on the upper left corner of the form. A user can use the control box to move, resize, maximize, minimize, or close a form. The ControlBox property has no effect in Visual FoxPro for Macintosh.

Setting the ControlBox property to false makes the minus sign or icon disappear, so the form can't be changed or closed using the control menu.

On a toolbar, setting the ControlBox property to false disables the minus sign in Windows 3.1 and Windows NT or the X box in Windows 95 that closes the toolbar. So if you want, you can disable the control box of a form or toolbar at run time until a user has performed a certain task. Then you can allow them to change or close a form or toolbar. Following is an example showing how to toggle the ControlBox property in a form at run time from true to false.

Step-by-Step Procedure to Toggle ControlBox Property

  1. Create a new form, and place a command button on it.
  2. In the click event of the command button, type the following code:
       IF THISFORM.CONTROLBOX
          THISFORM.CONTROLBOX=.F.
       ELSE
          THISFORM.CONTROLBOX=.T.
       ENDIF
    						
  3. Run the form, and note that there is an icon (a FoxPro head) in Windows 95 and Windows NT 4.0 or a minus sign in Windows 3.1 and Windows NT 3.51 in the upper-left corner of the form.
  4. Click the icon or minus sign, and note that there will be a drop down box that will allows the form to be controlled in various ways. After clicking the command button, the icon or minus sign disappears. Clicking the command button again brings back the icon or minus sign.

Modification Type:MajorLast Reviewed:9/30/2003
Keywords:kbcode KB143064