Phantom Documentation

[Help Home] [Phantom Home]
GetParent

window window.GetParent()

Applicable Classes: All

Return Type: window
Parameters: none

Description:
GetParent returns the direct parent window to this window. If this window does not have a parent, a null window is returned. To get the top-most parent, see the GetTopParent function. Note that a window can still have a parent window even if it is a top window. In the example below, the search will go all the way to the PhantomTarget window, even though the ComboBox control window is first in the window list (i.e. the top window).

Example Code

use "PhantomTarget.dec";
System("PhantomTarget.exe");

# Bring up a controls box
PhantomTarget._Controls.Combo_Box.Select();

# Get low level child
window W = Combo.ComboBox1.Edit1;

# Give the control time to appear, else W will
# be a null window
Sleep(1);

# Go up the parent chain
while(W){
  disp("Tag: " + W.Tag + "; Class: " + W.Class);
  W = W.GetParent();
}

# Get the top-most parent
W = Combo.ComboBox1.Edit1.GetTopParent();
disp("Top Parent: ");
disp("Tag: " + W.Tag + "; Class: " + W.Class);

# Exit out
Combo.OK.Click();
PhantomTarget.Close();


See Also: GetTopParent, GetChild


Copyright 2000-2011 Phantom Automated Solutions