File: ...\Samples\Solution\Forms\Sdiform.scx
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.
Adding Forms
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).
В | Copy Code |
---|---|
ACTIVATE WINDOW (thisform.oWindows[m.nGetWin].NAME) ; IN WINDOW (thisform.name) |
Adding Menus
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.
В | Copy Code |
---|---|
DO sdiform.mpr WITH THISFORM,.T. |
Note: |
---|
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. |
Adding Toolbars
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.
В | Copy Code |
---|---|
SET CLASSLIB TO sditbar ADDITIVE thisform.oToolbar=create("sditb1") thisform.oToolbar.show |