Parent Property Example

For each of the EXTRA! objects, this example shows how to return its parent object.

Sub Main()

 Dim Sys As Object, AllSess As Object, Sess As Object

 Dim MyScreen As Object, MyArea As Object

 Dim TBars As Object, QPads As Object, MyTBar As Object, MyQPad As Object


 Set Sys = CreateObject("EXTRA.System")

 Set AllSess = Sys.Sessions

' Assumes an open session. Retrieve objects.

 Set Sess = Sys.ActiveSession

 Set MyScreen = Sess.Screen

 Set MyArea = MyScreen.Area(1, 1, 10, 10, , 3)

 Set TBars = Sess.Toolbars

 Set QPads = Sess.QuickPads

 Set MyTBar = TBars(1)

 Set MyQPad = QPads(1)


 ' The System object is its own parent.

 MsgBox "System.Parent = " + Sys.Parent.Name


 'The parent of a Sessions object is also the System object.

 MsgBox "Sessions.Parent = " + AllSess.Parent.Name


 ' The parent of a Session object is a Sessions object,
 ' whose parent is ...

 MsgBox Sess.Parent.Parent.Name


 ' The parent of a Screen object is a Session object,
 ' whose parent is ...

 MsgBox MyScreen.Parent.Parent.Parent.Name


 ' The parent of a Toolbars object or QuickPads object is also a
 ' Session, whose parent is ...

 MsgBox TBars.Parent.Parent.Parent.Name

 MsgBox QPads.Parent.Parent.Parent.Name


 ' The parent of an Area object is a Screen object,
 ' whose parent is ...

 MsgBox MyArea.Parent.Parent.Parent.Parent.Name


 ' The parent of a Toolbar object is a Toolbars object,
 ' whose parent is ...

 MsgBox MyTBar.Parent.Parent.Parent.Parent.Name

 ' The parent of a QuickPad object is a QuickPads object,
 ' whose parent is ...

 MsgBox MyQPad.Parent.Parent.Parent.Parent.Name

End Sub