我想做一個函數傳入窗體對象,然後把這個窗體上的所有adotable等控件的readonly設為false,這個功能怎麼做?請指教謝謝!!
解决方案 »
- 《Delphi精要》谁愿意转让的,请联系我。
- 郁闷,我昨天在书店看见好几个民工模样的人在看java的书
- 一个很简单的问题,但我的运算怎么不对了。dd:integer, dd:=4* Int(((48 + 7) / 8 + 3) / 4); 怎么会说Incompatible types: 'Integer'
- Tform.Create(nil)和 Tform.Create(application) 有什么区别??
- FTP(急急急急急急急)
- 如何获取CPU号和网卡号!!
- 请问如何在dpr文件中声明一个公共变量(全局变量)?应该在哪个位置声明?
- linux下如何安装delphi?
- 在程序中使ComboBox的Text值改变,怎么不触发它的OnChange事件
- 如何从系统取得当前年份,再减去数据库中某一字段名(出生年月的),在lable.text中得出年龄?
- 请问大家一个简单的白痴的问题
- 想找个图表插件,但不太熟悉,大家给个建议,谢谢了
你直接选中所有的这些控件
他们的共同属性中就有这个选项
你把它false了不就可以了吗
if Form.Component[i] is TadoTable then
TadoTable(Form.Component[i]).ReadOnly := False;
begin
if Components[i] is TADOTable then
TADOTable(Components[i]).ReadOnly := False;
end;
begin
for i:=0 to Self.ComponentCount-1 do
begin
if Self.Components[i] is TadotableThen
begin
(Self.Components[i] as Tadotable).readonly:=False;
end;
end;
end;
function SetDSetReadOnly(var theForm: TForm; ReadOnly: boolean): Boolean;
var
i: integer;
begin
for i := 0 to theForm.ControlCount - 1 do
begin
if theForm.Controls[i] is TAdoTable then
(theForm.Controls[i] as TAdoTable).ReadOnly := ReadOnly;
if theForm.Controls[i] is TAdoQuery then
(theForm.Controls[i] as TAdoQuery).ReadOnly := ReadOnly;
end;
Result := ReadOnly;
end;
begin
SetDSetReadOnly(Form1,true);
end;