WPARENT( ) Function

Returns the name of the parent window of the active or specified window.

WPARENT([WindowName])

Return Value

Character

Parameters

  • WindowName
    Specifies a window whose parent window name WPARENT( ) returns. WPARENT( ) returns the empty string if the specified window doesn't have a parent window. If you omit WindowName, WPARENT( ) returns the name of the parent window of the active output window. WPARENT( ) returns the empty string if the active output window doesn't have a parent window.

Remarks

You can use DEFINE WINDOW to create a window and place it in a parent window. The child window becomes integrated with its parent window. For example, a child window defined and activated inside a parent window can't be moved outside the parent window. If the parent window is moved, the child window moves with it.

Example

The following example defines a parent and child window. It then uses WPARENT( ) to identify which window is the parent.

CLEAR ALL
CLEAR
DEFINE WINDOW wParent ;
   FROM 1,1 TO 20,20 ;
   TITLE 'wParent'     && Parent window
ACTIVATE WINDOW wParent
DEFINE WINDOW wChild ;
   FROM 1,1 TO 10,10 ;
   TITLE 'wChild' ;
   IN WINDOW wParent  && Child window
ACTIVATE WINDOW wChild
WAIT WINDOW 'The parent window is ' + WPARENT( )
RELEASE WINDOW wParent, wChild

See Also

Reference

ACTIVATE WINDOW Command

DEFINE WINDOW Command

WCHILD( ) Function

Other Resources

Functions

Language Reference (Visual FoxPro)