Freigeben über


DOCK Command

Docks an Integrated Development Environment (IDE) tool window or toolbar to the Visual FoxPro desktop window or another IDE window. There are two versions of the syntax.

Note

DOCK WINDOW is not supported during run time.

DOCK WINDOW WindowName1 | NAME ObjectName1 POSITION nPosition [ WINDOW WindowName2 | NAME ObjectName2 ]

DOCK WINDOW WindowName1 WINDOW WindowName2

Parameters

  • WindowName1
    Specifies the name of the window or toolbar to dock. For a user-defined toolbar, you can use the Caption property as its name.

    If you specify an undockable window as the window to be docked, it becomes dockable internally. For example:

    WDOCKABLE("Command", .F.)
    DOCK WINDOW Command
    ? WDOCKABLE("Command")  && Returns .T.
    

    If you want to dock a single window that is currently bound inside a tabbed or linked container to the main Visual FoxPro window, you must first undock it from the container, for example, by using POSITION -1 or WDOCKABLE(, .F. ).

    A tabbed or linked container is a set of tabbed or linked windows.

  • NAME ObjectName1
    Specifies an object reference for a valid dockable form to dock. If ObjectName1 is docked, Visual FoxPro undocks and redocks it as specified.

    Note

    If ObjectName1 is undefined or not valid, Visual FoxPro generates an error.

  • POSITION nPosition
    Specifies the docking position of the window or toolbar.

    The following table lists the possible values for nPosition.

    nPosition Docking position

    -3

    Undock inner container.

    -2

    Undock outer container.

    -1

    Undock window.

    Note

    When you specify a value of -1 for POSITION, you cannot include the WINDOW clause. Otherwise, a syntax error occurs.

    0

    Top

    1

    Left

    2

    Right

    3

    Bottom

    If nPosition is set between 0 and 3, the window is link-docked, for example, it appears attached to the side of another window.

    4

    Tabbed

    If nPosition is set to 4, the window is tab-docked, for example, it appears as a tabbed window.

    Note

    If you specify a value of 4 for POSITION, you must specify a WINDOW clause. Otherwise, an error occurs.

    Note

    Tab and link docking is not supported for debugger windows inside the Debug Frame. You can control the Frame setting in the Options dialog box. Toolbars do not support linked or tabbed docking.

    If a tabbed or linked container is docked, you can undock that container if you specify a value of -2 or -3 for any of the windows in the container, according to the following details:

    • If you pass a value of -2, the entire container is undocked if the container is docked to the Visual FoxPro desktop.

    • If you pass a value of -3, only the inner container that is part of an larger outer container is undocked. This applies only to tab-docked containers bound inside link-docked containers. If the window specified is not part of an inner tab-docked container, Visual FoxPro treats the value of -3 as a value of -2 and undocks entire outer container.

    • If the window specified is not part of a container, Visual FoxPro undocks it as if you passed a value of -1.

    If the window or container is already undocked, Visual FoxPro does nothing.

    For more information about linked and tabbed docking, see How to: Dock Windows.

  • WINDOW WindowName2
    Specifies the name of the target window or toolbar to dock with. If you omit the WindowName2 parameter, the window is docked to the Visual FoxPro desktop window.

    Note

    Visual FoxPro disregards the WINDOW keyword for toolbars. You can dock toolbars only to the desktop. No other window can be docked to a toolbar.

    You can use the WINDOW clause for linked and tabbed docking. DOCK WINDOW uses a tab-docking position as the default if you use DOCK WINDOW...WINDOW without including a POSITION clause.

    To dock an entire tabbed or linked container to the Visual FoxPro desktop window, call DOCK WINDOW with any of the windows in the container and omit the WINDOW clause.

    If you specify an undockable window as the docking target, Visual FoxPro generates "Function argument value, type, or count is invalid (Error 11)". For example:

    DOCK WINDOW Command WINDOW Standard   && Generates an error.
    
  • NAME ObjectName2
    Specifies an object reference for a valid dockable form to dock with. If ObjectName2 is docked, Visual FoxPro undocks and redocks it as specified.

    Note

    If ObjectName2 is undefined or not valid, Visual FoxPro generates an error.

Remarks

The following IDE windows and toolbars are supported by DOCK WINDOW:

  • All system toolbars

  • Call Stack

  • Command

  • Data Session (View)

  • Document View

  • Locals

  • Output

  • Properties

  • Trace

  • Watch

Both system and user-defined toolbars are supported by DOCK WINDOW.

Note

The specified window must first exist on the Visual FoxPro desktop; otherwise, an error occurs.

In prior versions of Visual FoxPro, the Data Session window is always referred to as the View window. Additionally, language used to control this window, such as HIDE WINDOW, ACTIVATE WINDOW, WONTOP( ), also refers to this window as the View window. Visual FoxPro continues to refer to the View window for the DOCK WINDOW command.

DOCK WINDOW always forces the window, if it exists, to become dockable and changes the setting for the Visible property of the window to True (.T.).

You can dock multiple windows that are docked as a group to another window by specifying one of the docked windows. However, if the docking target exists in the same container as the specified window, only that window is docked. This prevents cyclical relations. For example, the following code redocks the Command window to the right side of the Properties window:

DOCK WINDOW Command POSITION 4 WINDOW Properties
DOCK WINDOW Command POSITION 2 WINDOW Properties

Compare this example to the following code, which docks the Command and View windows to the Properties window as tabbed windows:

DOCK WINDOW Command POSITION 4 WINDOW View
DOCK WINDOW Command POSITION 4 WINDOW Properties

Tip

Deleting or editing the FoxUser.dbf resource file, which contains your user settings, restores your default window settings.

Example

The following example uses the DOCK WINDOW command to dock the Command window to the Visual FoxPro desktop window and uses ADOCKSTATE( ) to obtain the dock state of the Command window.

First, make sure the Command window is open. After docking the Command window, you can see that the Standard toolbar and Command windows are docked to the Microsoft Visual FoxPro desktop window. The position of the toolbars or windows in the array returned by ADOCKSTATE( ) can vary depending on the order in which the toolbars or windows are docked.

CLEAR
DOCK WINDOW Command POSITION 0
dockNum = ADOCKSTATE(dockState)
? dockNum   && Returns 2 only if Command window and 
            && Standard toolbar exist.
? dockState(1,1)  && Outputs "Standard". 
? dockState(1,4)  && Outputs "Microsoft Visual FoxPro".
? dockState(2,1)  && Outputs "COMMAND". 
? dockState(2,4)  && Outputs "Microsoft Visual FoxPro".

See Also

Reference

ADOCKSTATE( ) Function
WDOCKABLE( ) Function
Dock Method
DockPosition Property
Docked Property
BeforeDock Event
AfterDock Event
UnDock Event