TW3Component



TW3Component

Unit: SmartCL.Components.pas

Hierarchy
TObject
TW3TagObj
TW3Component
Properties
Property-icon.png Name
Property-icon.png Parent
Protected Methods
Protected method-icon.pngChildAdded
Protected method-icon.pngGetChildCount
Protected method-icon.pngGetChildObject
Methods
Method-icon.png ChildByHandle
Method-icon.png ChildByName
Method-icon.png TopLevelParent

Properties

Property-icon.png Name

Specifies the name of the component as referenced in code.

property Name: String read FName write setName;

Component’s name is automatically generated by Smart Mobile Studio when component is placed on Form.


Warning:

If Name is changed in run-time, new name can not be directly used (e.g. MyNewName.Property:= Value). Methods such as ChildByName must be used instead.


Example:

W3Button1.Name:= 'MyButton';// Next line will stop with: Syntax Error: Unknown name "MyButton" [line: 41, column: 3, file: Form1]
MyButton.Caption:= 'Click me!';

Property-icon.png Parent

Determine parent (container) of component.

property Parent: TW3Component read FParent;

TW3Component object may contain (be a Parent of) one or more child TW3Component components (Childs). Child component are referenced inside private array of TW3Component class. Child components may be accessed either by ChildByName or ChildByHandle methods.

TW3Component.Parent

Protected Methods

Protected method-icon.pngChildAdded

Called when component is created and Parent is set inside constructor.

procedure ChildAdded(aChild: TW3Component); virtual;

Descendants may override this method.

aChild

TW3Component
Reference of component being added.

Protected method-icon.pngGetChildCount

Return number of components inside Children array. This method count only direct children (it is not recursive).

function GetChildCount: Integer;

Protected method-icon.pngGetChildObject

Return child at specified index within Childs array.

function GetChildObject(index: Integer): TW3Component;

Parameters:

index

Integer
Indicate index of child. This parameter is zero-based.

Methods

Method-icon.png ChildByHandle

Returns child component based on Component’s Handler.

function ChildByHandle(const aHandle: THandle): TW3Component;

If component with specified Handler doesn’t exists, method return nil.


Parameters:

aHandle

THandle
Indicate THandle of Component’s reference searching for.

Method-icon.png ChildByName

Returns child component based on Component’s name.

function ChildByName(const compName: String): TW3Component;

Parameters:

compName

String
Indicate name of Component’s reference searching for.


Remarks:

If component with specified name doesn’t exists, method return nil.

Method-icon.png TopLevelParent

Determine root component (TDocumentBody).

function TopLevelParent: TW3Component;

This method iterate trough all Parent components (as displayed on diagram) back to the root Parent.


TW3Component.TopLevelParent