C++ Builder 參考手冊 ? System::Classes ? TComponent
System::Classes::TComponent 是所有組件的公共父類金抡。
- System::Classes::TComponent 簡介
- System::Classes::TComponent 成員
? 屬性
? 方法
? 事件
? 數(shù)據(jù)
一. System::Classes::TComponent 簡介
System::Classes::TComponent 是所有組件的公共父類铺董。
- 繼承關(guān)系:
System::TObject
?╙ System::Classes::TPersistent
???┗ System::Classes::TComponent - 頭文件:
#include <System.Classes.hpp>
- 命名空間:
System::Classes
- 控件 TControl 是從 TComponent 繼承的子類粹懒,所以所有的控件也都是組件,組件包含了所有的控件;
- 從 TControl 繼承的控件导街,運行的時候能夠顯示出來计福,這是 TControl 增加的功能佩厚,而 TComponent 并沒有處理顯示的代碼陶冷;
- TComponent 是不同框架 (VCL/FMX) 都公有的類煞额,在 System.Classes.hpp 里面基跑,而 TControl 在不同的框架里面有不同的實現(xiàn)栅螟,例如 Vcl::Controls::TControl 或 Fmx::Controls::TControl;
- 一般情況編寫不同框架有不同實現(xiàn)的控件,都是根據(jù) Vcl::Controls::TControl 或 Fmx::Controls::TControl 來分組和注冊框架不同而類名相同的控件的,如果不同的框架實現(xiàn)相同的控件,即各個框架公有的,都是從 TComponent 繼承過來的組件。
- 如果是繼承 TComponent 做的不需要顯示出來的組件,在不同的框架里面有不同的實現(xiàn),需要根據(jù) TControl 分組來區(qū)分框架,例如 ActivateClassGroup(__classid(Fmx::Controls::TControl));
二. System::Classes::TComponent 成員
1. System::Classes::TComponent 屬性
屬性 | 類型 | 說明 |
---|---|---|
__published: | ? | ? |
Name | TComponentName | 組件的名稱 |
Tag | NativeInt | 儲存一個 NativeInt 類型的數(shù)據(jù) |
public: | ? | ? |
ComObject | _di_IInterface | 控件的 COM 接口對象 |
Components | TComponent *[int Index] | 這個組件容納的第 Index 個子組件 |
ComponentCount | int | 這個組件容納的子組件的個數(shù) |
ComponentIndex | int | 這個控件是他的擁有者的第幾個子組件 |
ComponentState | TComponentState | 組件的狀態(tài) |
ComponentStyle | TComponentStyle | 組件的樣式 |
DesignInfo | int | 提供給畫面編輯器的信息 (設(shè)計時的位置) |
Observers | TObservers * | 組件 LiveBindings 的 TObservers 對象 |
Owner | TComponent | 組件的擁有者 |
VCLComObject | void * | 組件的 COM 組件對象 |
2. System::Classes::TComponent 方法
方法 | 說明 |
---|---|
public: | ? |
BeforeDestruction | 檢查并調(diào)用 Destroying 方法 |
BeginInvoke | 異步調(diào)用 AProc 或 AFunc |
DestroyComponents | 銷毀所有容納的子組件 |
Destroying | 指示這個組件和它所有的子組件都將被銷毀 |
EndFunctionInvoke | 等待異步執(zhí)行的函數(shù)的返回值 |
EndInvoke | 等待異步執(zhí)行完成 |
ExecuteAction | 執(zhí)行一個 Action |
FindComponent | 通過名稱查找子組件 |
FreeNotification | 把這個組件將要被銷毀的信息通知給 AComponent |
FreeOnRelease | 調(diào)用 COM 接口的 Release 方法時凰萨,會調(diào)用這個方法 |
GetEnumerator | 返回一個可以枚舉子組件的對象 |
GetParentComponent | 返回 Parent (容器) 組件 |
GetNamePath | 返回在 Object Inspector 屬性面板里面的名稱 |
HasParent | 獲取這個組件是否放在了容器里面 |
InsertComponent | 添加一個子組件 |
IsImplementorOf | 返回當前組件所支持的 COM 接口的引用 |
operator () | 類型轉(zhuǎn)換操作符冶忱,轉(zhuǎn)為 _di_IInterface 類型 或者 _di_IInterfaceComponentReference 類型 |
ReferenceInterface | 建立或移除內(nèi)部鏈接來通知這個組件 |
RemoveComponent | 移除一個子組件 |
RemoveFreeNotification | 把 FreeNotification 的通知信息去掉 |
SafeCallException | 處理 COM 接口的異常 |
SetSubComponent | 設(shè)置或清除 ComponentStyle 里面的 csSubComponent 樣式 |
TComponent | 構(gòu)造函數(shù)链沼。 |
~TComponent | 析構(gòu)函數(shù)。 |
UpdateAction | 更新 Action 的狀態(tài) |
protected: | ? |
_AddRef | 增加 COM 接口的引用計數(shù) |
AsyncSchedule | 把異步執(zhí)行添加到主線程的隊列里 |
CanObserve | 返回 LiveBindings 的數(shù)據(jù)綁定類型是否支持 |
ChangeName | 給組件改名 |
DefineProperties | 把非 __published: 屬性和數(shù)據(jù)存入流中 |
GetChildren | 枚舉所有的子組件 |
GetChildOwner | 返回子組件的 Owner |
GetChildParent | 返回子組件的 Parent |
GetDeltaStreams | 初始化從父類繼承過來的組件成員時使用。 |
GetIDsOfNames | 通過名字獲取 DISPID,用于調(diào)用 Invoke 方法 |
GetTypeInfoCount | 返回 IDispatch 的類型信息個數(shù) |
GetTypeInfo | 返回 IDispatch 的類型信息 |
GetObservers | Observers 屬性利用這個方法返回屬性值 |
GetOwner | 返回對象的擁有者 |
Invoke | 訪問 COM 對象的屬性和調(diào)用 COM 對象的方法 |
Loaded | 當 Form 讀取到內(nèi)存的時候蜡峰,初始化這個組件 |
Notification | AComponent 發(fā)過來的創(chuàng)建或移除消息粥诫,會調(diào)用這個方法 |
ObserverAdded | 添加 LiveBindings 數(shù)據(jù)綁定時會調(diào)用這個方法 |
PaletteCreated | 組件在組件面板里面創(chuàng)建的時候,會調(diào)用這個方法 |
QueryInterface | 返回當前組件所支持的 COM 接口的引用 |
ReadState | 從流中讀取組件的狀態(tài) |
_Release | 減少 COM 接口的引用計數(shù) / 銷毀對象 |
RemoveFreeNotifications | 通知所有的 Owner 這個組件要被銷毀了 |
SetAncestor | 清除或設(shè)置 ComponentState 屬性里面的 csAncestor 狀態(tài) |
SetChildOrder | 調(diào)整子組件的順序 |
SetDesigning | 清除或設(shè)置 ComponentState 屬性里面的 csDesigning 狀態(tài) |
SetDesignInstance | 清除或設(shè)置 ComponentState 屬性里面的 csDesignInstance 狀態(tài) |
SetInline | 清除或設(shè)置 ComponentState 屬性里面的 csInline 狀態(tài) |
SetName | 給屬性 Name 賦值調(diào)用這個方法來修改組件名 |
SetParentComponent | 設(shè)置組件的 Parent (容器組件) |
Updated | 清除 ComponentState 屬性里面的 csUpdating 狀態(tài) |
Updating | 設(shè)置 ComponentState 屬性里面的 csUpdating 狀態(tài) |
UpdateRegistry | 在注冊表里面添加 COM 組件類型庫信息 |
ValidateContainer | 檢查組件是否可以放入一個組件當作子組件 |
ValidateInsert | 檢查一個組件是否可以放入當前的組件作為子組件 |
ValidateRename | 給組件改名時調(diào)用绊率,檢查名稱是否有效 |
WriteState | 把組件的狀態(tài)寫入流中 |
TPersistent:: | 從 TPersistent 繼承過來的 |
public: | 從 TPersistent 繼承過來的 |
Assign | 把 Source 對象的所有的屬性和數(shù)據(jù)賦值到當前對象 |
protected: | ? |
AssignTo | 把當前對象的所有屬性和數(shù)據(jù)都賦值到 Dest 對象 |
TObject:: | 從 System::TObject 繼承過來的 |
public: | 從 System::TObject 繼承過來的 |
AfterConstruction | 在構(gòu)造函數(shù)結(jié)束的時候會自動調(diào)用 AfterConstruction |
ClassInfo | 返回運行時類型信息表 (RTTI table) |
ClassName | 獲取類名紊搪,不包含命名空間的類名字符串 |
ClassNameIs | 判斷類名是否為參數(shù)指定的字符串 |
ClassParent | 返回父類的類型信息 |
ClassType | 返回類的類型信息 |
CleanupInstance | 清除長字符串滞伟、Variants亩钟、接口變量等 |
DefaultHandler | 默認的消息處理 |
Dispatch | 處理消息的函數(shù) |
DisposeOf | 強制銷毀對象 |
Equals | 比較當前對象和 Obj 對象是否相同 |
FieldAddress | 通過成員名稱返回成員的地址 |
Free | 銷毀對象 (Delphi) |
FreeInstance | 釋放 NewInstance 分配的內(nèi)存 |
GetHashCode | 返回對象的 hash 值 |
GetInterface | 獲取指定的接口 |
GetInterfaceEntry | 獲取接口項目 |
GetInterfaceTable | 獲取接口表 |
InheritsFrom | 當前對象的類是否從 AClass 繼承過來的 |
InitInstance | 初始化成員臭觉,給他們清零 |
InstanceSize | 返回給實例數(shù)據(jù)分配內(nèi)存需要多少字節(jié)數(shù) |
MethodAddress | 通過名稱返方法的地址 |
MethodName | 通過方法的地址返回名稱 |
NewInstance | 給實例分配內(nèi)存旭从,并且返回新的實例的地址 |
QualifiedClassName | 返回包含命名空間的類名 |
ToString | 轉(zhuǎn)為字符串 |
UnitName | 返回類所在的命名空間 |
UnitScope | 返回類所在的命名空間 |
3. System::Classes::TComponent 事件
事件 | 說明 |
---|---|
protected: | ? |
OnGetDeltaStreams | 初始化從父類繼承過來的組件成員時產(chǎn)生的事件 |
4. System::Classes::TComponent 數(shù)據(jù)成員
數(shù)據(jù) | 類型 | 說明 |
---|---|---|
protected: | ? | ? |
FComponentStyle | TComponentStyle | 儲存組件樣式稳强,由組件內(nèi)部使用 |
相關(guān):
- Vcl::Controls::TControl
- System::Classes::TPersistent
- System::TObject
- VCL 類繼承關(guān)系
C++ Builder 參考手冊 ? System::Classes ? TComponent