$instancechildren

Return a list of component instances attached to a specified component instance.

$instancechildren { (InstanceName) }

Example: $valrep(LISTBOX) = $instancechildren

Parameters

Parameters
Parameter Data Type Description
InstanceName String Name of component instance; optional. If omitted, the current instance is used.

Return Values

  • List of the child instances attached to the specified instance. The list includes instances that are running remotely; it does not include forms that were started with the run statement.
  • Empty string ("") in the following cases:
    • InstanceName has no child instances.
    • InstanceName was omitted and the current instance is a Form started with run.
    • No instance named InstanceName can be found in the component pool.
    • InstanceName is not correct; that is, the field or variable is not found or the string is not a valid instance name.

Use

Allowed in all component types.

Description

An instance is attached to InstName if one of these statements is true:

  • It was created by a newinstance/attached statement.
  • It was created by a newinstance statement (or by an activate statement that did an implicit newinstance) and the Modality & Attachment property is set to Non-Modal, Attached.

The list returned by $instancechildren can be manipulated with ProcScript statements such as getitem, getlistitems, and so on.

Assigning Child Instances to a ValRep List

The following example fills the field LISTBOX with a list of the child instances of the current instance:

$valrep(LISTBOX) = $instancechildren

Related Topics