線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1253
推到 Plurk!
推到 Facebook!

checkbutton的問題

答題得分者是:careychen
chjunsen
一般會員


發表:38
回覆:15
積分:10
註冊:2006-10-25

發送簡訊給我
#1 引用回覆 回覆 發表時間:2008-11-27 20:57:52 IP:218.162.xxx.xxx 訂閱
各位大大請問要怎樣達到以下的效果
這樣寫程式是會有問題的!!
我想用迴圈將資料庫的資料組成rb02010000
然後指給check將這個check設true


lv_name:='rb02010000;
check:=lv_name;
check.Checked:=true;
careychen
尊榮會員


發表:41
回覆:580
積分:959
註冊:2004-03-03

發送簡訊給我
#2 引用回覆 回覆 發表時間:2008-11-27 22:09:22 IP:59.126.xxx.xxx 訂閱
【看您的問題像是在問如何找到 Form 上的元件】,我先依此回答,下次請您把問題及需求再描述清楚一點

[code delphi]
lv_name := 'rb02010000';
for I := 0 to Self.ComponentCount-1 do
if (Self.Components[I] is TCheckBox) and (TComponent(Self.Components[I]).Name = lv_name) then
begin
TCheckBox(Self.Components[I]).Checked := True;
break;
end;
[/code]

===================引 用 chjunsen 文 章===================
各位大大請問要怎樣達到以下的效果
這樣寫程式是會有問題的!!
我想用迴圈將資料庫的資料組成rb02010000
然後指給check將這個check設true


lv_name:='rb02010000;
check:=lv_name;
check.Checked:=true;
------
價值的展現,來自於你用哪一個角度來看待它!!
Coffee
版主


發表:31
回覆:878
積分:561
註冊:2006-11-15

發送簡訊給我
#3 引用回覆 回覆 發表時間:2008-11-27 22:37:44 IP:59.124.xxx.xxx 訂閱
for all containers built in Delphi win32, should have the properties Controls and Components, Components holds all the components in the container, and Controls holds all controls that is inherited from TControl(actually it is a protected property in class definition). If you want to lookup all the visible(that is for User Interactive) components, you can just iterate the Controls array to get the instance you want by name.
------
不論是否我發的文,在能力範圍皆很樂意為大家回答問題。
為了補我的能力不足之處,以及讓答案可以被重複的使用,希望大家能儘量以公開的方式問問題。
在引述到我的文時自然會儘量替各位想辦法,謝謝大家!
chjunsen
一般會員


發表:38
回覆:15
積分:10
註冊:2006-10-25

發送簡訊給我
#4 引用回覆 回覆 發表時間:2008-11-28 08:04:15 IP:218.162.xxx.xxx 訂閱
大大真是厲害.....真是萬分感謝...
系統時間:2024-05-06 14:01:22
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!