📄 realtyb112a.pas
字号:
unit RealtyB112A;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, dbcgrids, Grids, DBGrids, DB, ADODB, StdCtrls, Buttons, ExtCtrls,
StrUtils, ExtDlgs, ComCtrls, math;
type
Tf_RealtyB112A = class(TForm)
Button5: TButton;
Button6: TButton;
Label8: TLabel;
ComboBox1: TComboBox;
Label1: TLabel;
Label3: TLabel;
Edit2: TEdit;
Edit4: TEdit;
Edit3: TEdit;
Label10: TLabel;
Label5: TLabel;
Label2: TLabel;
Edit5: TEdit;
Edit1: TComboBox;
procedure FormCreate(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure Button6Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Edit1Select(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
bOK,bOK2:bool;
bMod:bool;
sNum:string;
end;
var
f_RealtyB112A: Tf_RealtyB112A;
implementation
uses data, main,RealtyB22A,Car4s931;
{$R *.dfm}
//初始化
procedure Tf_RealtyB112A.FormCreate(Sender: TObject);
var
query:TADOquery;
begin
query:=TADOquery.Create(nil);
query.Connection:=DatamoduleADO.ADOConnection1;
edit1.Items.Add('新增与客户关系');
query.SQL.Add('select * from 辅助资料 where 类别='''+'与客户关系'+'''');
query.Open;
while not query.Eof do
begin
edit1.Items.Add(query.fieldbyname('名称').value);
query.Next;
end;
ComboBox1.Items.Add('男');
ComboBox1.Items.Add('女');
if f_RealtyB22A.bMod then
begin
edit1.ItemIndex:=edit1.Items.IndexOf(f_RealtyB22A.ListView2.Selected.Caption);
edit2.Text :=f_RealtyB22A.ListView2.Selected.SubItems[0];
edit3.Text:=f_RealtyB22A.ListView2.Selected.SubItems[1];
combobox1.ItemIndex:=combobox1.Items.IndexOf(f_RealtyB22A.ListView2.Selected.SubItems[3]);
edit4.Text:=f_RealtyB22A.ListView2.Selected.SubItems[2];
edit5.Text:=f_RealtyB22A.ListView2.Selected.SubItems[4];
end;
end;
//Tab
procedure Tf_RealtyB112A.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key=13 then
Begin
key:=0;
perform(WM_NEXTDLGCTL,0,0);
end
else if key=VK_ESCAPE then close;
end;
//确定
procedure Tf_RealtyB112A.Button5Click(Sender: TObject);
Var
s:string;
begin
if edit1.Text='' then
begin
showmessage('与客户关系不能为空');
edit1.SetFocus;
exit;
end;
if edit2.Text='' then
begin
showmessage('名称不能为空');
edit2.SetFocus;
exit;
end;
if edit3.Text='' then edit3.Text:='-';
if edit4.Text='' then edit4.Text:='-';
if edit5.Text='' then edit5.Text:='-';
if f_RealtyB22A.bMod then
begin
with f_RealtyB22A.ListView2.Selected do
begin
Caption:=edit1.Text;
subitems[0]:=edit2.Text;
subitems[1]:=edit3.Text;
subitems[2]:=edit4.Text;
subitems[3]:=comboBox1.Text;
subitems[4]:=edit5.Text;
end;
end
else
begin
with f_RealtyB22A.ListView2.Items.Add do
begin
Caption:=edit1.Text;
subitems.Add(edit2.Text);
subitems.Add(edit3.Text);
subitems.Add(edit4.Text);
subitems.Add(comboBox1.Text);
subitems.Add(edit5.Text);
end;
end;
edit1.ItemIndex:=edit1.Items.IndexOf('');
edit2.Text:='';
edit3.Text:='';
edit4.Text:='';
edit5.Text:='';
combobox1.ItemIndex:=combobox1.Items.IndexOf('');
edit1.SetFocus;
end;
//退出
procedure Tf_RealtyB112A.Button6Click(Sender: TObject);
begin
Close;
end;
procedure Tf_RealtyB112A.Edit1Select(Sender: TObject);
begin
if edit1.Text='新增与客户关系' then
begin
mainform.t1:='与客户关系';
f_Car4s931:=Tf_Car4s931.Create(self);
f_Car4s931.showmodal;
if f_Car4s931.bOK=true then
begin
edit1.Items.Add(mainform.t1);
edit1.ItemIndex:=edit1.Items.IndexOf(mainform.t1);
end
else edit1.ItemIndex:=edit1.Items.IndexOf('');
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -