WChild(), WParent()
These functions let you figure out who's who among the window set. WCHILD() lets you find the child windows of a window, while WPARENT() gives you the parent window. Like most of the other window functions, we don't use these much anymore because we don't define our own windows—we use forms. Usage | cParentWindow = WPARENT( [ cWindowName ] ) nChildCount = WCHILD( [ cWindowName ] ) cNextChild = WCHILD( [ cWindowName, ] nCounter ) |
Parameter | Value | Meaning |
cWindowName | Character | The window about which you want parent or child information. |
Omitted | Return information about the current output window. | |
cParentWindow | Character | The name of the parent window of the specified window. |
Empty | The specified window sits right in the main Visual FoxPro window. | |
nChildCount | Numeric | The number of child windows for the specified window. |
nCounter | 0 | Return the name of the first child window. |
Any other number | Return the name of the next child window—the first call with nCounter included returns the first child. | |
cNextChild | Character | The name of the next child window of the specified window. |
Empty | There are no more child windows for the specified window. |
In VFP 5.0a and earlier, issuing a series of calls to WCHILD(<number>) on a window other than the main VFP window runs out of windows too soon. The last child window doesn't get reported. |
Example | * The most common thing to do is to loop through and find * all the children. * This example works on the active window. nChildCnt = WCHILD() WAIT WINDOW "This window has " + ; PADL(nChildCnt, 3) + " children." cChildName = WCHILD(0) DO WHILE NOT EMPTY(cChildName) WAIT WINDOW "One child is " + cChildName cChildName = WCHILD(1) ENDDO |
See Also | Define Window, WTitle() |
View Updates
Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.