This sample illustrates Visual FoxPro support of SDI forms. In order to create an SDI form, all you have to do is set the form's ShowWindow property to 2 вЂ“ s Top-Level Form. SDI forms do not require the Visual FoxPro window to be visible.
There are two ways to add forms to a Top-Level (SDI) form. The first and easiest is to create a new form and set its ShowWindow property to 1 (In Top-Level form). While this might seem the most appropriate, it is not always the best solution because the ShowWindow property can only be set at design time.
Another method is to use the ACTIVATE WINDOW command. The code below from the SDIForm sample shows just this. Since this command is not object-based, you must reference a form by its window name (Name property).
ACTIVATE WINDOW (thisform.oWindows[m.nGetWin].NAME) ; IN WINDOW (thisform.name)
Menus can also be added to SDI forms. There is now a new Top-Level Form check box in the Menu Designer's View menu General Options dialog box. A Top-Level Form menu will be generated if you check this option and can be called as shown here.
DO sdiform.mpr WITH THISFORM,.T.
|If system menu items rely on the main Visual FoxPro window being visible, they won't give the expected results when the main Visual FoxPro window is hidden.|
In addition to menus and windows, you can also add toolbars to your SDI forms. Toolbars are objects like forms, so you can take advantage of the Visual FoxPro object model and scope that toolbar to the form. The SDI form sample uses a custom property to create and keep the toolbar in scope.
SET CLASSLIB TO sditbar ADDITIVE thisform.oToolbar=create("sditb1") thisform.oToolbar.show