KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q143064: DOCERR: ControlBox Property Not Available at Run Time Per Help

Article: Q143064
Product(s): Microsoft FoxPro
Version(s): WINDOWS:3.0,3.0b
Operating System(s): 
Keyword(s): kbcode
Last Modified: 11-FEB-2000

-------------------------------------------------------------------------------
The information in this article applies to:

- Microsoft Visual FoxPro for Windows, versions 3.0, 3.0b 
-------------------------------------------------------------------------------

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.

Additional query words: VFoxWin

======================================================================
Keywords          : kbcode 
Technology        : kbVFPsearch kbAudDeveloper kbVFP300 kbVFP300b
Version           : WINDOWS:3.0,3.0b

=============================================================================

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.