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.
These properties determine whether a form contains the Windows standard Maximize and Minimize buttons.
frmForm.MaxButton = lHasMax
lHasMax = frmForm.MaxButton
frmForm.MinButton = lHasMin
lHasMin = frmForm.MinButton
Setting either of these properties to .F. leaves the corresponding option off the form’s control menu and ignores double-clicks on the form’s title bar, meaning that the user can’t maximize or minimize the form.
However, as with a number of other properties (like Movable), you can still change the form in code. Regardless of MaxButton and MinButton, you can maximize or minimize a form by setting its WindowState appropriately (or by using the old ZOOM WINDOW
command).
Be careful about programmatically minimizing windows with MinButton set to .F. The only way for the user to restore the window in that situation is by choosing it from the Window menu. Be even more careful about programmatically maximizing a window with no maximize button. There doesn’t seem to be any way for the user to restore that one.
Although you can control these properties individually, visually they’re linked at the hip. If either property is set to .T., both buttons appear, though one of them is disabled. However, Help is wrong when it says that an MDI child form always has a minimize button. If MinButton and MaxButton are both .F., the setting of MDIForm doesn’t matter—there are no buttons.
MaxButton and MinButton are among the properties that must be .F. in order to have a truly borderless form in VFP 3 and VFP 5. See BorderStyle for the complete list. (In VFP 6 and later versions, you can do it with just TitleBar and BorderStyle.)
ThisForm.MaxButton = .F. && user can't maximize
ThisForm.WindowState = 2 && but you can