TW3Component
Unit: SmartCL.Components.pas
- Hierarchy
- TObject
- TW3TagObj
- TW3Component
- TW3TagObj
Properties |
---|
Name |
Parent |
Protected Methods |
ChildAdded |
GetChildCount |
GetChildObject |
Methods |
ChildByHandle |
ChildByName |
TopLevelParent |
Properties
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!';
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.
Protected Methods
ChildAdded
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.
GetChildCount
Return number of components inside Children array. This method count only direct children (it is not recursive).
function GetChildCount: Integer;
GetChildObject
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
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.
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.
TopLevelParent
Determine root component (TDocumentBody).
function TopLevelParent: TW3Component;
This method iterate trough all Parent components (as displayed on diagram) back to the root Parent.