Partilhar via


WCHILD( ) Function

Returns either the number of child windows in a parent window or the names of the child windows in the order in which they are stacked in the parent window.

WCHILD([WindowName] [nChildWindow])

Return Values

Character or Numeric

Parameters

  • WindowName
    Specifies a window other than the active output window for which WCHILD( ) returns the number of child windows. The number of child windows in the specified window is returned if you include just a window name without the numeric expression nChildWindow.

    If you include both WindowName and nChildWindow, WCHILD( ) returns the names of the child windows in the specified window. If you include both WindowName and nChildWindow, separate WindowName and nChildWindow with a comma.

    You can also include the empty string in WindowName to specify the main Visual FoxPro window.

  • nChildWindow
    Specifies a numeric expression included to return the names of child windows in the active output window when you omit WindowName.

    The numeric expression nChildWindow can be 0 or any positive value. The name of the child window at the bottom of the stack of child windows in the current output window is returned if nChildWindow is 0.

    If nChildWindow is a positive number, WCHILD( ) returns the name of the next child window in the window stack. The name of next child window in the stack is returned if you issue WCHILD( ) again with a positive number, and so on. The empty string is returned if WCHILD( ) is called more times than the number of child windows in the parent window. For more information on window stacking, see ACTIVATE WINDOW.

    Note   In Visual FoxPro for Windows, if the main Visual FoxPro window is active, all windows are children of the main Visual FoxPro window. In Visual FoxPro, toolbars that are not docked in the border of the main Visual FoxPro window are children of the main Visual FoxPro window. Issuing a series of WCHILD( ) functions with positive numbers returns the names of the active windows and toolbars.

    If you include both WindowName and nChildWindow, separate WindowName and nChildWindow with a comma.

Remarks

You can create a window (the parent window) and place other windows (child windows) inside. Including the IN or IN WINDOW clause in DEFINE WINDOW creates a child window inside the parent window. A child window created and activated inside a parent window cannot be moved outside the parent window. If the parent window is moved, the child window moves with it.

The number of child windows in the active output window is returned if you issue WCHILD( ) without any arguments.

See Also

ACTIVATE WINDOW | DEFINE WINDOW | WPARENT( )