Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

ControlBox

This property determines whether forms and toolbars have a control menu available in the upper left corner.

Usage

oObject.ControlBox = lHasControlMenu
lHasControlMenu = oObject.ControlBox

For forms (and _SCREEN), the contents of the control menu, if it’s there, are determined by other properties. MaxButton and MinButton control the Maximize and Minimize items, respectively. Movable controls the Move item. Closable controls the Close item. BorderStyle, of all things, controls the Size item—sizing is available only when BorderStyle=3.

Setting ControlBox to .F. also disables the Minimize, Maximize and Close buttons on the title bar.

The TitleBar property, added in VFP 6, overrides the setting of ControlBox. If TitleBar is 0, there’s no control menu or any of the other stuff that normally resides on the title bar—that’s because there’s no title bar.

For toolbars, ControlBox determines whether you get a Close button. Before you turn this one off, think hard about it. In most applications, the user should decide whether a particular toolbar is available or not. While we recognize that there are some specialized applications where keeping a toolbar alive is essential, in the average data entry app, it shouldn’t be.

Example

_SCREEN.ActiveForm.ControlBox = .F.  && Turn off control menu

See Also

BorderStyle, Closable, MaxButton, MinButton, Movable, TitleBar