这个按钮怎么会导致输入法关闭了呢?请教(20分)

  • 主题发起人 yedixifeng
  • 开始时间
Y

yedixifeng

Unregistered / Unconfirmed
GUEST, unregistred user!
这个修改的按钮怎么会导致输入法关闭了呢?
procedure Tdw_form.SpeedButton16Click(Sender: TObject);
begin
speedbutton15.Enabled := false;
speedbutton17.Enabled := false;
with database do
begin
adoq1.Connection := adoc;
adoq1.SQL.Clear;
adoq1.SQL.Add('select * from jldw where 单位编码=:dwbm');
adoq1.Parameters.ParamByName('dwbm').Value := edit4.Text;
adoq1.Active := true;
if adoq1.Recordset.RecordCount > 0 then
begin
edit1.Text := adoq1.Fields.Fields[0].AsString;
edit2.Text := adoq1.Fields.Fields[1].AsString;
edit3.Text := adoq1.Fields.Fields[2].AsString;
edit1.ReadOnly := true;
edit2.SetFocus;
end
else
showmessage('请刷新选择记录!');
end;
end;
而保存的按钮就不关闭,如下
procedure Tdw_form.SpeedButton15Click(Sender: TObject);
begin
if (length(edit1.Text) <> 0) and (length(edit2.Text) <> 0) then
begin
with database do
begin
adoq1.Connection := adoc;
adoq1.SQL.Clear;
adoq1.SQL.Add('select * from jldw where 单位编码=:dwbm');
adoq1.Parameters.ParamByName('dwbm').Value := edit1.Text;
adoq1.Active := true;
if adoq1.Recordset.RecordCount > 0 then
begin
showmessage('已有此信息,请重输!');
adoq1.SQL.Clear;
adoq1.SQL.Add('select * from jldw order by 单位编码');
adoq1.Active := true;
statusbar1.Panels[1].Text := inttostr(adoq1.Recordset.RecordCount);
datas1.DataSet := adoq1;
dbgrid1.DataSource := datas1;
edit2.SetFocus;
end
else
begin
adoq1.SQL.Clear;
adoq1.SQL.Add('insert into jldw(单位编码,计量单位,说明,计量单位简码) values:)dwbm,:jldw,:sm,:jldwjm)');
adoq1.parameters.ParamByName('dwbm').value := edit1.text;
adoq1.parameters.ParamByName('jldw').value := edit2.text;
adoq1.parameters.ParamByName('sm').value := edit3.text;
adoq1.parameters.ParamByName('jldwjm').value := edit5.text;
adoq1.ExecSQL;
adoq1.SQL.Clear;
adoq1.SQL.Add('select * from jldw');
adoq1.Active := true;
datas1.DataSet := adoq1;
dbgrid1.DataSource := datas1;
statusbar1.Panels[1].Text := inttostr(adoq1.Recordset.RecordCount);
edit1.Clear; edit2.Clear; edit3.Clear;
edit2.SetFocus;
Edit1.Text := 'dw'+formatdatetime('yymmdd-hhmmss',now);
end;
end;
end
else
begin
showmessage('请输入单位编码和单位名称');
edit2.SetFocus;
end;
end;
 
顶部