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.

WindowType

This property determines whether a form or formset is modal or modeless. It also determines whether it’s a real Visual FoxPro form or a backward-compatibility READ form.

Usage

oObject.WindowType = nWindowType
nWindowType = oObject.WindowType

There are four choices for WindowType, but you’ll only want to use two of them in forms you create in Visual FoxPro. Types 2 and 3 are for forms converted from FoxPro 2.x—2 is modeless READ-type, and 3 is modal READ-type. In fact, you can’t even choose these two in the Property Sheet. Because no one (okay, no one except the people who wrote the code in the first place) knows how they work, we urge you to forget you ever read about them.

When you create forms and formsets with CREATEOBJECT(), you can set WindowType before you Show the thing. Or you can just pass the appropriate parameter to the Show method.

You can’t change WindowType while the form is displayed, but you can change it while it’s hidden. However, we can’t imagine why you’d want to change an existing form from modal to modeless or vice versa. That’s bound to confuse the heck out of your users.

Most forms are either modal or modeless all the time. Either it’s a dialog or a document. You can set WindowType in the Form Designer and be done with it.

We have occasionally run into a form that’s usually a document, but once in a while needs to be called modally from another form. That’s where the opportunity to change WindowType (or pass the parameter to Show) at runtime comes in handy.

Example

oForm = CreateObject("Form")
oForm.WindowType = 1  && Make form modal
oForm.Show()

See Also

Show