Positions a ToolBar or Form object along a border of the main Visual FoxPro window or positions a Form object within Visual FoxPro IDE windows or with other forms. To use the Dock method for forms, the form's Dockable property must be set to 1. There are two versions of the syntax.
Toolbar.Dock(nLocation [, X, Y]) Form.Dock(nLocation, [, oForm])
Specifies the location to dock the toolbar or form.
The following table lists the values for nLocation.
nLocation Description FoxPro.h constant
Undocks the toolbar or form.
Positions the toolbar or form at the top of the main Visual FoxPro window.
Positions the toolbar or form at the left side of the main Visual FoxPro window.
Positions the toolbar or form at the right side of the main Visual FoxPro window.
Positions the toolbar or form at the bottom of the main Visual FoxPro window.
Tab docks a form with another window. (Forms only)
- X, Y
- Specifies the horizontal and vertical coordinates respectively for the toolbar docking position.
- Specifies an object reference to another form for tab or link docking.
Logical data type. Dock returns True (.T.) if the item successfully docks. Otherwise, Dock returns False (.F.).
Visual FoxPro does not support docking for top-level forms. Therefore, Visual FoxPro disregards a docked form's ShowWindow property, which determines whether a form is a top-level form and always defaults the property's value to 0.
When calling the Dock method, the Activate and Resize events occur.
You cannot dock items recursively. For example, you cannot dock one form while docking another.
The following example uses the CREATEOBJECT( ) function to create a form, sets the Dockable and Visible properties so that the form is dockable and visible, and uses the Dock method to dock the form to the left side of the main Visual FoxPro window.
omyForm = CREATEOBJECT("Form") omyForm.Dockable = 1 omyForm.Visible = .T. omyForm.Dock(1)