procedure TForm11.checkcls;
var
i:integer;
begin
for i := ComponentCount -1 downto 0 do
begin
if (Components[i] is TDBcheckbox) then
begin
TDBCheckbox(Components[i]).Checked := False;
end;
end;
end;代码如上述:
这个过程无法将新增数据的DBcheckbox改变成为空选项!
procedure TForm11.SpeedButton2Click(Sender: TObject);
begin
checkhf;
TEdithf;
checkcls;
GPJL_DM.DataModule1.ADOQ_Hplbwh.Append;
end; checkhf;
TEdithf;
这两个过程代码如下:procedure TForm11.checksz;
var
i:integer;
begin
for i := ComponentCount -1 downto 0 do
begin
if (Components[i] is TDBCheckbox) then
begin
TDBCheckbox(Components[i]).ReadOnly := True;
TDBCheckbox(Components[i]).Enabled := False;
end;
end;
end;procedure TForm11.checkhf;
var
i:integer;
begin
for i := ComponentCount -1 downto 0 do
begin
if (Components[i] is TDBcheckbox) then
begin
TDBCheckbox(Components[i]).ReadOnly := False;
TDBCheckbox(Components[i]).Enabled := True;
end;
end;
end;
var
i:integer;
begin
for i := ComponentCount -1 downto 0 do
begin
if (Components[i] is TDBcheckbox) then
begin
TDBCheckbox(Components[i]).Checked := False;
end;
end;
end;代码如上述:
这个过程无法将新增数据的DBcheckbox改变成为空选项!
procedure TForm11.SpeedButton2Click(Sender: TObject);
begin
checkhf;
TEdithf;
checkcls;
GPJL_DM.DataModule1.ADOQ_Hplbwh.Append;
end; checkhf;
TEdithf;
这两个过程代码如下:procedure TForm11.checksz;
var
i:integer;
begin
for i := ComponentCount -1 downto 0 do
begin
if (Components[i] is TDBCheckbox) then
begin
TDBCheckbox(Components[i]).ReadOnly := True;
TDBCheckbox(Components[i]).Enabled := False;
end;
end;
end;procedure TForm11.checkhf;
var
i:integer;
begin
for i := ComponentCount -1 downto 0 do
begin
if (Components[i] is TDBcheckbox) then
begin
TDBCheckbox(Components[i]).ReadOnly := False;
TDBCheckbox(Components[i]).Enabled := True;
end;
end;
end;
试试
TDBCheckbox(Components[i]).datasource.data.fieldbyname( TDBCheckbox(Components[i]).fieldname ).asboolean = false / true ;
如:fieldbyname(fieldname).asboolean := false;
然后存盘即可