【delphi开源代码栏目提醒】:网学会员在delphi开源代码频道为大家收集整理了Dictionary_Browser_U.pas提供大家参考,希望对大家有所帮助!
{
unit name : Dictionary_Browser_U
Author : 李涛
Create date:
description: 字典信息管理
}
unit Dictionary_Browser_U;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Mask, DBCtrls, Buttons, ExtCtrls, ADODB;
type
TDictionary_Browser = class(TForm)
PanelTop: TPanel;
Panel_ICO: TPanel;
Fun_ICO: TImage;
PanelTopText: TPanel;
PanelBottom: TPanel;
Panel2: TPanel;
App_ICO: TImage;
PanelBottomText: TPanel;
ADD_Bit: TBitBtn;
Cancel_Bit: TBitBtn;
GroupBox1: TGroupBox;
Label3: TLabel;
Label4: TLabel;
Label7: TLabel;
Label1: TLabel;
Label2: TLabel;
Label5: TLabel;
Label6: TLabel;
Code_DB: TDBEdit;
Name_DB: TDBEdit;
BZ_DB: TDBEdit;
Stop_Check: TCheckBox;
LX_checked: TCheckBox;
procedure ADD_BitClick(Sender: TObject);
procedure Cancel_BitClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormKeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
UserComponent: TComponent;
State: string; //描述当前窗口处于什么状态。insert添加update修改delete删除
{ Public declarations }
end;
var
Dictionary_Browser: TDictionary_Browser;
implementation
uses Dictionary_info_u;
{$R *.dfm}
procedure TDictionary_Browser.ADD_BitClick(Sender: TObject);
begin
if (Length(Code_DB.Text)=0) or (Length(Name_DB.Text)=0) then
//or (Length(BZ_DB.Text)=0) then
begin
ShowMessage('请将信息填写完整!');
Code_DB.SetFocus;
Exit;
end;
//-------------------------------------------------------------------------
//返回实例中指定控件。
UserComponent:=Dictionary_info.Dictionary_ADO;
//-------------------------------------------------------------------------
With TADOTable(UserComponent) do
begin
FieldByName('C_sort_code').Value:=Label6.Caption;
if Stop_Check.Checked then
FieldByName('C_stop').Value:='1'
else
FieldByName('C_stop').Value:='0';
if LX_checked.Checked then //连续状态
begin
Post;
Append;
Code_DB.SetFocus;
end
else
begin
Post;
Cancel_Bit.Click;
end;
end;
end;
procedure TDictionary_Browser.Cancel_BitClick(Sender: TObject);
begin
//-------------------------------------------------------------------------
//返回实例中指定控件。
UserComponent:=Dictionary_info.Dictionary_ADO;
//-------------------------------------------------------------------------
if (TADOQuery(UserComponent).Modified) then
begin
TADOQuery(UserComponent).Cancel;
end;
close;
end;
procedure TDictionary_Browser.FormShow(Sender: TObject);
begin
//-------------------------------------------------------------------------
//返回实例中指定控件。
UserComponent:=Dictionary_info.Dictionary_ADO;
//-------------------------------------------------------------------------
if State='update' then
if TADOQuery(UserComponent).FieldByName('C_Stop').Value='0' then
Stop_Check.Checked:=false
else
Stop_Check.Checked:=True;
end;
procedure TDictionary_Browser.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action:=caFree;
Dictionary_Browser:=nil;
end;
procedure TDictionary_Browser.FormKeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then PerForm(WM_nextdlgctl,0,0);
end;
end.
上一篇:
frmGlyph.frm
下一篇:
个人哪些方面的情况值得你在简历里做介绍?