TPanel中有很多动态生成的按钮,遍历整个TPanel找到按钮并置成false
for i:=0 to ButtonParent.Controlcount-1 do
begin
if (ButtonParent.Controls[i] is TButton) then
begin
TButton(ButtonParent.Components[i]).Enabled := False;
end;
end;
我这段代码有什么问题?
界面中有10几个控件,TButton有6个
但是报List index out of bounts(3)的错误?
...全文
856打赏收藏
寻找控件中的按钮,并置成False
TPanel中有很多动态生成的按钮,遍历整个TPanel找到按钮并置成false for i:=0 to ButtonParent.Controlcount-1 do begin if (ButtonParent.Controls[i] is TButton) then begin TButton(ButtonParent.Components[i]).Enabled := False; end; end; 我这段代码有什么问题? 界面中有10几个控件,TButton有6个 但是报List in
for i:=0 to ButtonParent.Controlcount-1 do
begin
if (ButtonParent.Controls[i] is TButton) then
begin
TButton(ButtonParent.Controls[i].Enabled := False;