FindControl相關 |
答題得分者是:sos_admin
|
ooctiger
一般會員 發表:25 回覆:46 積分:14 註冊:2002-07-08 發送簡訊給我 |
請教各位
FindControl用法及時機
以下是Help中找到的資料
Returns the widget whose window is identified by the specifiedhandle or which appears at a specified position. Unit QControls Category Widget utilitiesWidget utilities function FindControl(Handle: QWidgetH): TWidgetControl; function FindControl(const Pos: TPoint): TWidgetControl; Description Call FindControl to access the widget whose window is identified by the Handle parameter or which appears at the position specified by the Pos parameter. If Handle is not the handle of a widget, or if there is no widget at the specified position, FindControl returns nil.因為實在不懂如何應用,還請各位幫忙. |
sos_admin
版主 發表:121 回覆:697 積分:768 註冊:2003-07-23 發送簡訊給我 |
您上面的是clx用法,对于windows平台一般用vcl的 function FindControl(Handle: HWnd): TWinControl; 可以返回指定handle的对象!
用法如下:
var
mycon:twincontrol;
begin
mycon:=FindControl(handle);
if mycon<>nil then
showmessage(mycon.Name); end; 發表人 - sos_admin 於 2003/08/29 14:07:50
|
ooctiger
一般會員 發表:25 回覆:46 積分:14 註冊:2002-07-08 發送簡訊給我 |
引言: 您上面的是clx用法,对于windows平台一般用vcl的 function FindControl(Handle: HWnd): TWinControl; 可以返回指定handle的对象! 用法如下: var mycon:twincontrol; begin mycon:=FindControl(handle); if mycon<>nil then showmessage(mycon.Name); end; 發表人 - sos_admin 於 2003/08/29 14:07:50 var mycon:twincontrol; 又出現看不懂的地方了 begin mycon:=FindControl(handle); if mycon<>nil then showmessage(mycon.Name); end;這個例子雖可執行,但我還是不懂其意義為何 才疏學淺,請再指點一下. Thanks |
sos_admin
版主 發表:121 回覆:697 積分:768 註冊:2003-07-23 發送簡訊給我 |
|
ooctiger
一般會員 發表:25 回覆:46 積分:14 註冊:2002-07-08 發送簡訊給我 |
|
sos_admin
版主 發表:121 回覆:697 積分:768 註冊:2003-07-23 發送簡訊給我 |
tlabel 不是从Twincontrol继承下来的没有handle,如果要找用下面方法: procedure TForm1.Button1Click(Sender: TObject);
var
i:integer;
begin for i:=0 to form1.ComponentCount -1 do
if form1.Components[i] is TLabel then
if (form1.Components[i] as TLabel).Name='Label1' then
showmessage('find'); end;
|
ooctiger
一般會員 發表:25 回覆:46 積分:14 註冊:2002-07-08 發送簡訊給我 |
|
紫電靑霜
一般會員 發表:2 回覆:9 積分:2 註冊:2008-05-15 發送簡訊給我 |
|
eaglewolf
資深會員 發表:4 回覆:268 積分:429 註冊:2006-07-06 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |