Parent Property

Purpose

Returns the parent Form object for the given OCX.

Syntax

Set f = object.Parent

object:Ocx Object
f:Form Object

Description

Parent is used to get the parent window for an Ocx. Use the Parent property to access the properties, methods, or controls of an object's parent.

Example

OpenW 1

Ocx Command cmd1 = "Move Parent", 10, 10, 100, 40

Do

Sleep

Until Me Is Nothing

 

Sub cmd1_Click

MoveParent(cmd1)

EndSub

 

Sub MoveParent(o As Object)

' Move Parent to a random position

If TypeOf(o.parent) Is Form

o.Parent.Move PixelsToTwipX(Random(300)), PixelsToTwipY(Random(200))

EndIf

EndSub

Remarks

The Parent property is useful in an application in which you pass objects as arguments. For example, you could pass a control variable to a general procedure, and use the Parent property to access its parent form.

There is no relationship between the Parent property and the MdiChild property. There is, however, a parent-child relationship between an MdiParent object and any Form object that has its MdiChild property set to True.

See Also

Form, MdiParent

{Created by Sjouke Hamstra; Last updated: 21/10/2014 by James Gaite}