📄 indata.pas
字号:
if key = #13 then { 判断是按执行键}
Begin
key:=#0;
perform(WM_NEXTDLGCTL,0,0);{移动到下一个控件}
if Form2.SpeedButton3.Enabled
then
if Form2.SpeedButton2.Enabled then form2.speedbutton2.Click ;
if not Form2.SpeedButton3.Enabled then
if Form2.SpeedButton1.Enabled then form2.speedbutton1.Click;
end;
end;
procedure TForm2.ComboBox3KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
tmpp:=combobox3.Text;
end;
procedure TForm2.ComboBox4KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
tmpp:=combobox4.Text;
end;
procedure TForm2.ComboBox1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
tmpp:=combobox1.Text;
end;
procedure TForm2.ComboBox2KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
tmpp:=combobox2.Text;
end;
procedure TForm2.ComboBox2Change(Sender: TObject);
var
i:integer;
begin
i:=0;
while i<combobox2.Items.Count do
begin
if combobox2.Text=combobox2.Items[i] then
break;
inc(i);
end;
if i>=combobox2.Items.Count then begin application.MessageBox('属性值选择不对','提示',mb_ok);combobox2.Text:=tmpp;combobox2.SetFocus;exit; end;
if Form2.SpeedButton3.Enabled
then Form2.SpeedButton2.Enabled := true
else Form2.SpeedButton1.Enabled := true;
end;
procedure TForm2.ComboBox1Change(Sender: TObject);
var
i:integer;
begin
i:=0;
while i<combobox1.Items.Count do
begin
if combobox1.Text=combobox1.Items[i] then
break;
inc(i);
end;
if i>=combobox1.Items.Count then begin application.MessageBox('属性值选择不对','提示',mb_ok);combobox1.Text:=tmpp;combobox1.SetFocus;exit; end;
if Form2.SpeedButton3.Enabled
then Form2.SpeedButton2.Enabled := true
else Form2.SpeedButton1.Enabled := true;
end;
procedure TForm2.ComboBox4Change(Sender: TObject);
var
i:integer;
begin
i:=0;
while i<combobox4.Items.Count do
begin
if combobox4.Text=combobox4.Items[i] then
break;
inc(i);
end;
if i>=combobox4.Items.Count then begin application.MessageBox('属性值选择不对','提示',mb_ok);combobox4.Text:=tmpp;combobox4.SetFocus;exit; end;
if (combobox4.Text='警告') or (combobox4.Text='免处') then begin application.MessageBox('属性值不能选择警告或免处,如果要输入,在这输入后再到处罚菜单中去修改!','提示',mb_ok);combobox4.ItemIndex:=0;combobox4.SetFocus; end;
if Form2.SpeedButton3.Enabled
then Form2.SpeedButton2.Enabled := true
else Form2.SpeedButton1.Enabled := true;
end;
procedure TForm2.ComboBox3Change(Sender: TObject);
var
i:integer;
begin
i:=0;
while i<combobox3.Items.Count do
begin
if combobox3.Text=combobox3.Items[i] then
break;
inc(i);
end;
if i>=combobox3.Items.Count then begin application.MessageBox('属性值选择不对','提示',mb_ok);combobox3.Text:=tmpp;combobox3.SetFocus;exit; end;
if Form2.SpeedButton3.Enabled
then Form2.SpeedButton2.Enabled := true
else Form2.SpeedButton1.Enabled := true;
end;
procedure TForm2.CheckBox2Click(Sender: TObject);
begin
if trim(memo1.Text)<>'' then begin checkbox2.Checked:=true; exit;end;
if checkbox2.Checked=true then
begin
memo1.Clear;
memo1.Visible:=true;
end
else
begin
memo1.Clear;
memo1.Visible:=false;
end;
end;
procedure TForm2.Memo1KeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if memo1.Lines.Count>10 then
begin
application.MessageBox('你所输入的备注信息超过了140个字,跳出警告,请用鼠标点击确定,绝不能用ENTER键取消','警告',mb_ok);exit;
end;
end;
procedure TForm2.Edit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
tmpp:=edit1.Text;
end;
procedure TForm2.SpeedButton7Click(Sender: TObject);
begin
form1.query1.Close;
form1.query1.SQL.Clear;
form1.Query1.UnPrepare;
form1.query1.SQL.Add('select * from "wf_zl_info" a,"cl" b where a.clzl=b.clbm and wrsj=:p2 and scbz=:p1 and cfqr='''+'N'+''''+' and sfbz='''+'N'+'''order by a.TZSHM ');
form1.query1.ParamByName('p1').AsString:='N';
form1.query1.ParamByName('p2').Value:=datetostr(date);
form1.Query1.Prepare;
form1.query1.Open;
Form2.edit2.SetFocus;
end;
procedure TForm2.Edit2Exit(Sender: TObject);
begin
if form2.SpeedButton3.Enabled=true then exit;
form1.tempquery.Close;
form1.tempquery.SQL.Clear;
form1.tempquery.SQL.Add('select * from wf_zl_info where TZSHM=:p1');
form1.tempquery.ParamByName('p1').AsString:=trim(edit2.Text);
form1.tempquery.Open;
if form1.tempquery.RecordCount>0 then
begin
try
edit2.SetFocus;
application.MessageBox('数据库中已存在以通知书号码为索引的记录!','提示');
except
;
end;
end;
form1.tempquery.Close;
end;
procedure TForm2.Edit2KeyPress(Sender: TObject; var Key: Char);
begin
if key = #13 then { 判断是按执行键}
Begin
key:=#0;
{ form2.perform(WM_NEXTDLGCTL,0,0);{移动到下一个控件}
combobox2.SetFocus;
end;
if Form2.SpeedButton3.Enabled
then Form2.SpeedButton2.Enabled := true
else Form2.SpeedButton1.Enabled := true;
end;
procedure TForm2.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if Form2.SpeedButton3.Enabled
then Form2.SpeedButton2.Enabled := true
else Form2.SpeedButton1.Enabled := true;
if key = #13 then { 判断是按执行键}
Begin
key:=#0;
{ form2.perform(WM_NEXTDLGCTL,0,0);{移动到下一个控件}
combobox1.SetFocus;
end;
end;
procedure TForm2.ComboBox2KeyPress(Sender: TObject; var Key: Char);
begin
if Form2.SpeedButton3.Enabled
then Form2.SpeedButton2.Enabled := true
else Form2.SpeedButton1.Enabled := true;
if key = #13 then { 判断是按执行键}
Begin
key:=#0;
{ form2.perform(WM_NEXTDLGCTL,0,0);{移动到下一个控件}
edit1.SetFocus;
end;
end;
procedure TForm2.ComboBox1KeyPress(Sender: TObject; var Key: Char);
begin
if key = #13 then { 判断是按执行键}
Begin
key:=#0;
{ form2.perform(WM_NEXTDLGCTL,0,0);{移动到下一个控件}
datetimepicker1.SetFocus;
end;
end;
procedure TForm2.DateTimePicker1KeyPress(Sender: TObject; var Key: Char);
begin
if key = #13 then { 判断是按执行键}
Begin
key:=#0;
{ form2.perform(WM_NEXTDLGCTL,0,0);{移动到下一个控件}
edit3.SetFocus;
end;
end;
procedure TForm2.DateTimePicker2KeyPress(Sender: TObject; var Key: Char);
begin
if key = #13 then { 判断是按执行键}
Begin
key:=#0;
{ form2.perform(WM_NEXTDLGCTL,0,0);{移动到下一个控件}
//edit3.SetFocus;
end;
end;
procedure TForm2.Edit3KeyPress(Sender: TObject; var Key: Char);
begin
if Form2.SpeedButton3.Enabled
then Form2.SpeedButton2.Enabled := true
else Form2.SpeedButton1.Enabled := true;
if key = #13 then { 判断是按执行键}
Begin
key:=#0;
{ form2.perform(WM_NEXTDLGCTL,0,0);{移动到下一个控件}
combobox3.SetFocus;
end;
end;
procedure TForm2.ComboBox4KeyPress(Sender: TObject; var Key: Char);
begin
if key = #13 then { 判断是按执行键}
Begin
key:=#0;
{ form2.perform(WM_NEXTDLGCTL,0,0);{移动到下一个控件}
//edit5.SetFocus;
end;
end;
procedure TForm2.ComboBox3KeyPress(Sender: TObject; var Key: Char);
begin
if key = #13 then { 判断是按执行键}
Begin
key:=#0;
{ form2.perform(WM_NEXTDLGCTL,0,0);{移动到下一个控件}
edit6.SetFocus;
end;
end;
procedure TForm2.Memo1KeyPress(Sender: TObject; var Key: Char);
begin
if Form2.SpeedButton3.Enabled
then Form2.SpeedButton2.Enabled := true
else Form2.SpeedButton1.Enabled := true;
if key=#13 then
begin
key:=#0;
application.MessageBox('不能用回车键,只能用空格换行','提示',mb_ok);
memo1.Lines.Add(''); //空格换行
end;
end;
procedure TForm2.Edit2MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
// form2.SpeedButton2.Enabled:=true;
end;
procedure TForm2.CheckBox1Click(Sender: TObject);
begin
if checkbox1.Checked=true then checkbox2.Checked:=true;
end;
procedure TForm2.Edit1Exit(Sender: TObject);
begin
if length(pchar(edit1.Text))<>5 then begin application.MessageBox('车牌号码不等于5位','警告',MB_OK);edit1.Text:=tmpp;end;
end;
procedure TForm2.Edit2KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
tmpp:=edit2.Text;
end;
function TForm2.checkr(str:string):boolean;
var
i:integer;
begin
result:=true;
for i:=1 to length(str) do
begin
case str[i] of
'0' :;
'1' :;
'2' :;
'3' :;
'4' :;
'5' :;
'6' :;
'7' :;
'8' :;
'9' :;
else
result:=false;
end;
end;
end;
procedure TForm2.Edit2KeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if not checkr(edit2.Text) then
begin
application.MessageBox('陈述通知书号中存在非数字的符号!','提示',MB_OK);
edit2.Text:=tmpp;
end;
end;
procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
begin
form1.tempquery.Close;
form1.Query1.Close;
end;
procedure TForm2.Edit1KeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if length(pchar(edit1.Text))>5 then begin application.MessageBox('车牌号码不等于5位','警告',MB_OK);edit1.Text:=tmpp;end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -