同时有个全选反选的按钮的脚本如下,也不能做到更改
procedure TForm3.btn4Click(Sender: TObject);
begin
with qryvoucher do
begin
try
DisableControls;
if (not isempty) then
begin
first;
while not eof do
begin
edit;
FieldByname('IsSelect').AsBoolean := not FieldByname('IsSelect').AsBoolean;
next;
end;
end;
finally
EnableControls;
end
end;
end;
procedure TForm3.btn4Click(Sender: TObject);
begin
with qryvoucher do
begin
try
DisableControls;
if (not isempty) then
begin
first;
while not eof do
begin
edit;
FieldByname('IsSelect').AsBoolean := not FieldByname('IsSelect').AsBoolean;
next;
end;
end;
finally
EnableControls;
end
end;
end;
我在使用DBGridEh时,未遇到这种情况。
是否设置该字符“isSelect”为只读?
还有就是调用的函数过程什么的,里面有可能有影响点击生效的操作。
实在不行设置一下KeyPreview试一试,但这个似乎没什么道理。
你应该没有设置为TRUE
不过这种编辑方式还是很危险的
2、 这种情况一般是DBGridEh的数据集未牌编辑状态,适当的事件中加入Edit,试试。
begin
with qryvoucher do
begin
try
DisableControls;
if (not isempty) then
begin
first;
while not eof do
begin
edit;
FieldByname('IsSelect').AsBoolean := not FieldByname('IsSelect').AsBoolean;
post;//====================
next;
end;
end;
finally
EnableControls;
end
end;
end;
https://mp.csdn.net/postedit/86216084