FindComponent
来源:互联网 发布:智能网络机顶盒 编辑:程序博客网 时间:2024/05/16 14:04
function TComponent.FindComponent(const AName: string): TComponent;
var
I: Integer;
begin
if (AName <> '') and (FComponents <> nil) then
for I := 0 to FComponents.Count - 1 do
begin
Result := FComponents[I];
if SameText(Result.FName, AName) then Exit;
end;
Result := nil;
end;
--是在拥有的控件里面找
Owner属性是指构件的所有者,它负责构件的创建和释放。如在上例中,系统默认窗体上所有构件的所有者是窗体,而窗体的所有者是Application。顺便指出,create
方法应带有表示构件所有者的参数,如在上例中,构件所有者是窗体,即self。
//输入对应的组件的名称,如果找到就返回组件的引用,没有找到就返回nil
例子:
var
s: TComponent;
a: string;
begin
a := InputBox('输入框', '请输入要查找的组件', 'aa');
s := FindComponent(a);
if s <> nil then
ShowMessage(s.ClassName)
else
ShowMessage('没有找到,笨死了!');
end;
- FindComponent
- FindChildControl与FindComponent
- RegisterClass和FindComponent
- FindChildControl与FindComponent
- BCB-控制多個元件的方法-FindComponent()
- 四巨头GoF的《设计模式》中23种设计模式的UML图 - 1 of 4
- fn contains 包含字符串 判断
- 数据库学习笔记(一)
- [计算机] -32768~32767 计算机中的 -1 表示
- shell脚本中要注意的地方
- FindComponent
- Prime Palindromes
- 自己的任务
- Oracle默认端口清单
- c++ 大数类 大数模板
- Linux套接字
- 元数据驱动的应用程序设计和开发
- android 屏幕保持唤醒 不锁屏 android.permission.WAKE_LOCK
- SharePoint 2013 中开发可以被标记为未读和已读的列表之代码实现篇