GetParent PowerScript function
Description
Obtains the parent of the specified object.
Controls
Any object
Syntax
1 |
<span>objectname</span>.<span>GetParent</span> ( ) |
Argument |
Description |
---|---|
objectname |
A control in a window or user object |
Return Values
PowerObject. Returns a reference to the parent of objectname.
Examples
In event scripts for a user object that will be used
as a tab page, you can use code like the following to make references
to the parent Tab control generic:
1 |
// a_tab is generic; |
1 |
// it does not know about specific pages |
1 |
tab a_tab |
1 |
1 |
// a_tab_page is generic; |
1 |
// it does not know about specific controls |
1 |
userobject a_tab_page |
1 |
1 |
// Get values for the Tab control and the tab page |
1 |
a_tab = this.GetParent( ) |
1 |
// Somewhat redundant, for illustration only |
1 |
a_tab_page = this    |
1 |
1 |
// Set properties for the tab page |
1 |
a_tab_page.PowerTipText = "Important property page" |
1 |
// Set properties for the Tab control |
1 |
a_tab.PowerTips = TRUE |
1 |
1 |
// Run Tab control functions |
1 |
a_tab.SelectTab(a_tab_page) |
You cannot refer to controls on the user object because a_tab_page does
not know about them. You cannot refer to specific pages in the Tab
control because a_tab does not know
about them either.
In event scripts for controls on the tab page user
object, you can use two levels of GetParent to refer to the user
object and the Tab control containing the user object as a tab page:
1 |
// For a control, add one more level of GetParent() |
1 |
// and you can make the same settings as above |
1 |
tab a_tab |
1 |
userobject a_tab_page |
1 |
1 |
a_tab_page = this.GetParent() |
1 |
a_tab = a_tab_page.GetParent() |
1 |
1 |
a_tab_page.PowerTipText = "Important property page" |
1 |
a_tab.PowerTips = TRUE |
1 |
1 |
a_tab.SelectTab(a_tab_page) |