sz_kws.pas
资源名称:挡案管理系统.rar [点击查看]
上传用户:szruida
上传日期:2007-06-01
资源大小:6518k
文件大小:21k
源码类别:
Delphi控件源码
开发平台:
Delphi
- unit sz_kws;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, Menus, ActnList, DB, XPBarMenu, Grids, DBGridEh, StdCtrls, Mask,
- DBCtrls, ComCtrls, ExtCtrls, ToolWin, DBClient,
- DBTables, PrnDbgeh, DBGrids;
- type
- Tsz_kw = class(TForm)
- CoolBar1: TCoolBar;
- ToolBar1: TToolBar;
- add1: TToolButton;
- xiugai: TToolButton;
- dele1: TToolButton;
- save1: TToolButton;
- Refresh1: TToolButton;
- ToolButton3: TToolButton;
- Panel1: TPanel;
- Splitter1: TSplitter;
- Panel2: TPanel;
- Panel3: TPanel;
- Splitter2: TSplitter;
- Panel4: TPanel;
- Label8: TLabel;
- Label9: TLabel;
- Label10: TLabel;
- Label1: TLabel;
- Label2: TLabel;
- Label3: TLabel;
- Label4: TLabel;
- Edit1: TEdit;
- Panel5: TPanel;
- GroupBox2: TGroupBox;
- XPBarMenu1: TXPBarMenu;
- DataSource1: TDataSource;
- ActionList1: TActionList;
- Add: TAction;
- Edit: TAction;
- Delete: TAction;
- Save: TAction;
- Refresh: TAction;
- Print: TAction;
- Quit: TAction;
- PopupMenu1: TPopupMenu;
- A1: TMenuItem;
- D1: TMenuItem;
- E1: TMenuItem;
- N5: TMenuItem;
- N6: TMenuItem;
- Tree: TTreeView;
- DBGridEh1: TDBGridEh;
- dbEdit1: TEdit;
- DbEdit2: TEdit;
- DbEdit3: TEdit;
- DbEdit4: TEdit;
- ClientDataSet1: TClientDataSet;
- procedure QuitExecute(Sender: TObject);
- procedure FormClose(Sender: TObject; var Action: TCloseAction);
- procedure AddExecute(Sender: TObject);
- procedure EditExecute(Sender: TObject);
- procedure SaveExecute(Sender: TObject);
- procedure DeleteExecute(Sender: TObject);
- procedure DBGridEh1CellClick(Column: TColumnEh);
- procedure RefreshExecute(Sender: TObject);
- procedure FormShow(Sender: TObject);
- procedure dbEdit1KeyPress(Sender: TObject; var Key: Char);
- procedure DbEdit2KeyPress(Sender: TObject; var Key: Char);
- procedure TreeClick(Sender: TObject);
- procedure TreeChange(Sender: TObject; Node: TTreeNode);
- procedure N5Click(Sender: TObject);
- procedure N6Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- procedure loadTree(treeDb:TClientDataSet);//初始化树
- procedure BtnState();//增,改时的按钮变化
- procedure SaveData(TreeView:TtreeView;edit1,edit2,edit4:Tedit);//保存数据
- end;
- var
- sz_kw: Tsz_kw;
- gnode:TtreeNode;//当前节点
- lbjs_sm:string;//类别级数
- lb_dmgz:string;//代码规则
- dsState:string;//确定是增,删,改
- implementation
- uses mainfrms,dms,u_public, ljszs;
- {$R *.dfm}
- procedure Tsz_kw.BtnState();
- begin
- if add1.Enabled=true or xiugai.Enabled=true then
- begin
- add1.Enabled:=false;A1.Enabled:=false;
- xiugai.Enabled:=false;E1.Enabled:=false;
- dele1.Enabled:=false;D1.Enabled:=false;
- save1.Enabled:=true;
- refresh1.Enabled:=true;
- end
- else
- begin
- add1.Enabled:=true;A1.Enabled:=true;
- xiugai.Enabled:=true;E1.Enabled:=true;
- dele1.Enabled:=true;D1.Enabled:=true;
- save1.Enabled:=false;
- refresh1.Enabled:=true;
- end;
- end;
- procedure Tsz_kw.SaveData(TreeView:TtreeView;edit1,edit2,edit4:Tedit);//保存数据
- var
- curnode:TTreenode;//已选树节点
- Pnodetxt,nodetxt:string;//Pnodetxt:取出树节点的代码;nodetxt:要在树节点上增加的值
- n:integer;//取出'-'在已选树节点中的位置
- Tdbedit3:Tedit;
- begin
- dm.sz_kw.edit;
- n:=pos('-',TreeView.Selected.Text)-1;
- Pnodetxt:=copy(TreeView.Selected.Text,1,n);
- nodetxt:=Pnodetxt+dbedit1.Text+'-'+dbedit2.Text;//现在节点等于原来的加上现在的
- //增加数据到节点
- dm.sz_kw.FieldByName('kw_dm').AsString:=Pnodetxt+dbedit1.Text;
- dm.sz_kw.FieldByName('kw_mc').AsString:=dbedit2.Text;
- dm.sz_kw.FieldByName('kw_js').AsInteger:=tree.Selected.Level;
- dm.sz_kw.FieldByName('kw_sm').AsString:=dbEdit4.Text;
- dm.sz_kw.FieldByName('kw_sjkwdm').AsString:=Pnodetxt;
- //给数组赋值
- dm.sz_kw.ApplyUpdates(0);
- application.MessageBox('数据保存成功','提示',mb_ok+mb_iconinformation);
- curnode:=TreeView.Items.AddChild(tree.Selected,nodetxt);//增加新的节点
- curnode.ImageIndex:=0;
- curnode.SelectedIndex:=1;
- //-------按钮状态
- dbedit1.Text:='';
- dbedit2.Text:='';
- dbedit3.Text:='';
- dbedit4.Text:='';
- dsState:='';
- end;
- {当然,本文的核心是LoadTree过程,该函数用了一个循环来遍历数据表sz_kw的所有记录,
- 将字段kw_dm和kw_mc的内容按层次显示出来。而在该函数中定义的二维数组MyNode[0..6],
- 则显得优为重要,在这里,它作用类似于递归中的栈。因为在TTreeView 添加子节点的方
- 法AddChild(Node: TTreeNode; const S: string)中,要为其指定一父节点作为参数,而
- 父节点的代码级数一定是要添加节点的代码级数减1,所以只要用一数组来动态保存和指定
- 父节点就成功了}
- //以下函数是本文的重点部分,其主要功能是用一循环将sz_kw表中的
- //以下函数将库位表中的库位代码和库位代码名称显示出来
- procedure Tsz_kw.loadTree(treeDb:TClientDataSet);//初始化树
- var
- nodeId,nodeTxt:string;
- SCodeFormat,SFirstNodeTxt:string;
- level:integer;
- mynode:array[0..6] of Ttreenode;
- begin
- //初始化变量
- SCodeFormat:=lbjs_sm ; //库位代码结构
- SFirstNodeTxt:= '库位'; //首节点显示的文字
- Screen.Cursor:=crHourGlass;
- Tree.enabled:=true;
- tree.Items.Clear;
- level:=0;
- //设置根节点
- mynode[level]:=tree.Items.Add(tree.TopItem,'库位');
- mynode[level].ImageIndex:=0;
- mynode[level].SelectedIndex:=1;
- //遍历数据表,利用编码字段记录排序规律,依次添加树节点
- with treeDB do
- begin
- try
- if not active then open;
- first;
- while not treedb.Eof do
- begin
- nodeId:=trim(fieldbyname('kw_dm').AsString);
- nodeTxt:=nodeId+'-'+trim(fieldbyname('kw_mc').AsString);
- level:=GetNodeLevel(SCodeFormat,nodeId);//获得节点层树
- //再这里返回代码的层次数
- if level>0 then
- begin
- //增加下一节点时,用添加子节点的方法可以轻松实现节点的层次关系
- //注意,这里的父节点是用当前节点的上一级节点mynode[level-1]
- mynode[level]:=tree.Items.AddChild(mynode[level-1],nodeTxt);
- mynode[level].ImageIndex:=0;
- mynode[level].SelectedIndex:=1;
- end;//end if
- next;//下一条纪录
- end;//end while
- finally;
- close;
- end;
- mynode[0].Expand(false);
- screen.Cursor:=crdefault;
- end;//end with
- end;
- procedure Tsz_kw.QuitExecute(Sender: TObject);
- begin
- close;
- end;
- procedure Tsz_kw.FormClose(Sender: TObject; var Action: TCloseAction);
- begin
- dm.sz_kw.Active:=false;
- dm.xt_lbjs.active:=false;
- action:=cafree;
- sz_kw:=nil;
- tree.Free;
- end;
- procedure Tsz_kw.AddExecute(Sender: TObject);
- begin
- if tree.Selected=nil then
- exit
- else
- dm.sz_kw.Close;
- dm.sz_kw.CommandText:='select * from sz_kw where kw_dm='+''''+''''+'';
- dm.sz_kw.Open;
- if tree.Selected.level>length(lbjs_sm)-1 then
- begin
- application.MessageBox('已经到达最底层的节点,不能再增加','提示',mb_ok+mb_iconinformation);
- exit;
- end;
- dbedit1.SetFocus;
- dbedit1.Text:='';
- dbedit2.text:='';
- dbedit4.Text:='';
- dbedit3.Text:=IntToStr(tree.Selected.level);
- BtnState();//调用按钮的状态参数
- dsState:='add';
- end;
- procedure Tsz_kw.EditExecute(Sender: TObject);//修改数据
- var s1,s2:string;
- Epos:integer;
- begin
- if tree.selected=nil then
- exit
- else
- if tree.Items.Count<>0 then
- if Tree.Items[0].HasChildren<>false then
- begin
- BtnState();//调用按钮的状态参数
- s1:=Tree.Selected.Text;
- Epos:=pos('-',s1);//取得'-'在节点名中的位置
- s2:=copy(s1,0,Epos-1);//
- dm.sz_kw.Close;
- dm.sz_kw.CommandText:='select * from sz_kw where kw_dm='+''''+s2+''''+'';
- dm.sz_kw.Open;
- dbedit1.Text:=dm.sz_kw.fieldbyname('kw_dm').AsString;
- Dbedit1.Enabled:=false;
- DBEdit1.Color:=cl3DLight;
- dm.sz_kw.edit;
- end
- else
- begin
- application.MessageBox('当前表中没有数据,不能修改','提示',mb_ok+mb_iconinformation);
- exit;
- end;
- end;
- procedure Tsz_kw.SaveExecute(Sender: TObject);
- var
- s_sj,yanzheng:string;//yangzheng查找数据库中是否有重复记录存在
- Pnodetxt:string;//pnodetxt:父节点值
- n,n_sj:integer;
- begin
- if dbedit1.Text='' then
- begin
- application.MessageBox('库位代码不能为空','提示',mb_ok+mb_iconinformation);
- exit;
- end;
- if dbedit2.Text='' then
- begin
- application.MessageBox('库位名称不能为空','提示',mb_ok+mb_iconinformation);
- exit;
- end;
- //---------------------验证必须输入的数据
- //判断是增加还是修改*****************************************************
- if dbedit1.Enabled=true then
- begin
- if tree.Selected.Level=length(lbjs_sm) then
- begin
- application.MessageBox('已经到达最底层节点'#13#10'不能增加','提示',mb_ok+mb_iconinformation);
- exit;
- end else
- case tree.Selected.Level of
- //************************************************************************
- 0: begin
- if length(dbedit1.Text)<>strtoInt(copy(lbjs_sm,1,1)) then
- begin
- hint:='请输入'+copy(lbjs_sm,1,1)+'位代码';
- application.MessageBox(Pchar(hint),'提示',mb_okcancel+mb_iconinformation);
- exit;
- end
- else//
- begin
- yanzheng:=dbedit1.Text;
- dm.sz_kw.Close;
- dm.sz_kw.CommandText:='select * from sz_kw where kw_dm='+''''+yanzheng+''''+'';
- dm.sz_kw.Open;
- if dm.sz_kw.FieldByName('kw_dm').AsString<>'' then
- begin
- application.MessageBox('已经有重复纪录存在','提示',mb_ok+mb_iconinformation);
- exit;
- end
- else
- begin
- SaveData(tree,dbedit1,dbedit2,dbedit4);//调用保存过程
- BtnState();//调用按钮的状态参数
- end;
- end;//end if 0
- end;
- //************************************************************************
- 1: begin
- if length(dbedit1.Text)<>strtoInt(copy(lbjs_sm,2,1)) then
- begin
- hint:='请输入'+copy(lbjs_sm,2,1)+'位代码';
- application.MessageBox(Pchar(hint),'提示',mb_okcancel+mb_iconinformation);
- exit;
- end
- else//1111111111111111111111111111111111111111111111111111111111111
- begin//else begin
- n_sj:=pos('-',tree.Selected.Text)-1;
- s_sj:=copy(tree.Selected.Text,0,n_sj);
- yanzheng:=s_sj+dbedit1.text;//节点含有子节点
- dm.sz_kw.Close;
- dm.sz_kw.CommandText:='select * from sz_kw where kw_dm='+''''+yanzheng+''''+'';
- dm.sz_kw.Open;
- if dm.sz_kw.FieldByName('kw_dm').AsString<>'' then
- begin
- application.MessageBox('已经有重复纪录存在','提示',mb_ok+mb_iconinformation);
- exit;
- end
- else
- begin//@@@@
- SaveData(tree,dbedit1,dbedit2,dbedit4);//调用保存过程
- BtnState();//调用按钮的状态参数
- end;//@@@@
- end;//end else begin
- end;//end 1
- //************************************************************************
- 2: begin
- if length(dbedit1.Text)<>strtoInt(copy(lbjs_sm,3,1)) then
- begin
- hint:='请输入'+copy(lbjs_sm,3,1)+'位代码';
- application.MessageBox(Pchar(hint),'提示',mb_okcancel+mb_iconinformation);
- exit;
- end
- else
- begin//else begin
- n_sj:=pos('-',tree.Selected.Text)-1;
- s_sj:=copy(tree.Selected.Text,0,n_sj);
- yanzheng:=s_sj+dbedit1.text;//节点含有子节点
- dm.sz_kw.Close;
- dm.sz_kw.CommandText:='select * from sz_kw where kw_dm='+''''+yanzheng+''''+'';
- dm.sz_kw.Open;
- if dm.sz_kw.FieldByName('kw_dm').AsString<>'' then
- begin
- application.MessageBox('已经有重复纪录存在','提示',mb_ok+mb_iconinformation);
- exit;
- end
- else
- begin//@@@@
- SaveData(tree,dbedit1,dbedit2,dbedit4);//调用保存过程
- BtnState();//调用按钮的状态参数
- end;//@@@@
- end;
- end;
- 3: begin
- if length(dbedit1.Text)<>strtoInt(copy(lbjs_sm,4,1)) then
- begin
- hint:='请输入'+copy(lbjs_sm,4,1)+'位代码';
- application.MessageBox(Pchar(hint),'提示',mb_okcancel+mb_iconinformation);
- exit;
- end
- else
- begin
- n_sj:=pos('-',tree.Selected.Text)-1;
- s_sj:=copy(tree.Selected.Text,0,n_sj);
- yanzheng:=s_sj+dbedit1.text;//节点含有子节点
- dm.sz_kw.Close;
- dm.sz_kw.CommandText:='select * from sz_kw where kw_dm='+''''+yanzheng+''''+'';
- dm.sz_kw.Open;
- if dm.sz_kw.FieldByName('kw_dm').AsString<>'' then
- begin
- application.MessageBox('已经有重复纪录存在','提示',mb_ok+mb_iconinformation);
- exit;
- end
- else
- begin//@@@@
- SaveData(tree,dbedit1,dbedit2,dbedit4);//调用保存过程
- BtnState();//调用按钮的状态参数
- end;//@@@@
- end;
- end;
- 4: begin
- if length(dbedit1.Text)<>strtoInt(copy(lbjs_sm,5,1)) then
- begin
- hint:='请输入'+copy(lbjs_sm,5,1)+'位代码';
- application.MessageBox(Pchar(hint),'提示',mb_okcancel+mb_iconinformation);
- exit;
- end
- else
- begin
- n_sj:=pos('-',tree.Selected.Text)-1;
- s_sj:=copy(tree.Selected.Text,0,n_sj);
- yanzheng:=s_sj+dbedit1.text;//节点含有子节点
- dm.sz_kw.Close;
- dm.sz_kw.CommandText:='select * from sz_kw where kw_dm='+''''+yanzheng+''''+'';
- dm.sz_kw.Open;
- if dm.sz_kw.FieldByName('kw_dm').AsString<>'' then
- begin
- application.MessageBox('已经有重复纪录存在','提示',mb_ok+mb_iconinformation);
- exit;
- end
- else
- begin//@@@@
- SaveData(tree,dbedit1,dbedit2,dbedit4);//调用保存过程
- BtnState();//调用按钮的状态参数
- end;//@@@@
- end;
- end;
- 5: begin
- if length(dbedit1.Text)<>strtoInt(copy(lbjs_sm,6,1)) then
- begin
- hint:='请输入'+copy(lbjs_sm,6,1)+'位代码';
- application.MessageBox(Pchar(hint),'提示',mb_okcancel+mb_iconinformation);
- exit;
- end
- else
- begin
- n_sj:=pos('-',tree.Selected.Text)-1;
- s_sj:=copy(tree.Selected.Text,0,n_sj);
- yanzheng:=s_sj+dbedit1.text;//节点含有子节点
- dm.sz_kw.Close;
- dm.sz_kw.CommandText:='select * from sz_kw where kw_dm='+''''+yanzheng+''''+'';
- dm.sz_kw.Open;
- if dm.sz_kw.FieldByName('kw_dm').AsString<>'' then
- begin
- application.MessageBox('已经有重复纪录存在','提示',mb_ok+mb_iconinformation);
- exit;
- end
- else
- begin//@@@@
- SaveData(tree,dbedit1,dbedit2,dbedit4);//调用保存过程
- //refresh1.Click;
- BtnState();//调用按钮的状态参数
- end;//@@@@
- end;
- end;//end 5
- end;//end case
- end//结束增加的情况
- else
- begin //修改后的情况
- dm.sz_kw.edit;
- Tree.Selected.EditText;//修改节点
- Tree.Selected.Text:=Dbedit1.text+'-'+DbEdit2.Text;
- tree.Selected.ImageIndex:=0;
- tree.Selected.SelectedIndex:=1;
- //增加数据到节点
- dm.sz_kw.FieldByName('kw_dm').AsString:=dbedit1.Text;
- dm.sz_kw.FieldByName('kw_mc').AsString:=dbedit2.Text;
- dm.sz_kw.FieldByName('kw_js').AsInteger:=tree.Selected.Level;
- dm.sz_kw.FieldByName('kw_sm').AsString:=dbEdit4.Text;
- //给树赋值
- dm.sz_kw.ApplyUpdates(0);
- application.MessageBox('数据保存成功','提示',mb_ok+mb_iconinformation);
- //refresh1.Click;//刷新
- BtnState();
- dbedit1.Enabled:=true;
- dbedit1.Color:=clwindow;
- end;
- end;
- procedure Tsz_kw.DeleteExecute(Sender: TObject);
- var
- epos:integer;
- s1,s2:string;
- begin
- if tree.Selected=nil then
- exit
- else
- if tree.Items[0].HasChildren then
- if tree.Selected.HasChildren=true then
- begin
- application.messagebox('该部门包含下级,不能删除','提示',MB_OKCANCEL+mb_iconinformation );
- end
- else
- begin
- if application.messagebox('您确实要删除当前记录吗?','提示',MB_OKCANCEL+mb_iconquestion )=IDOK then
- begin
- s1:=Tree.Selected.Text;
- Epos:=pos('-',s1);//取得'-'在节点名中的位置
- s2:=copy(s1,0,Epos-1);//
- tree.Selected.Delete;//删除树形表中数据
- //--------------------------------------
- dbedit1.Text:='';dbedit2.text:='';dbedit4.Text:='';
- Clientdataset1.Close;
- Clientdataset1.CommandText:='select * from sz_kw';
- Clientdataset1.Open;//
- if Clientdataset1.recordcount=0 then
- begin
- dele1.Enabled:=false;
- xiugai.Enabled:=false;
- end;//--------------------------
- dm.sz_kw.Close;
- dm.sz_kw.CommandText:='delete from sz_kw where kw_dm='+''''+s2+''''+'';
- dm.sz_kw.execute;
- dm.sz_kw.Close;
- dm.sz_kw.CommandText:='select * from sz_kw';
- dm.sz_kw.Open;
- //删除表中数据
- end;
- end;
- end;
- procedure Tsz_kw.DBGridEh1CellClick(Column: TColumnEh);
- var
- s1,s2:string;
- i:integer;
- begin//--1单击每一行时,使树形控件也变化
- s1:=DBGridEh1.Columns[1].DisplayText;
- s2:=DBGridEh1.Columns[2].DisplayText;
- dm.sz_kw.Locate('kw_dm','+''''+s1+''''+',[]);
- //过滤要搜索的数据
- dbedit1.Text:=dm.sz_kw.fieldbyname('kw_dm').AsString;
- dbedit2.Text:=dm.sz_kw.fieldbyname('kw_mc').AsString;
- dbedit3.Text:=dm.sz_kw.fieldbyname('kw_js').AsString;
- dbedit4.Text:=dm.sz_kw.fieldbyname('kw_sm').AsString;
- if Tree.Items[0].HasChildren<>false then
- begin//end if
- for i:=0 to Tree.items.count-1 do
- if Tree.Items[i].Text=s1+'-'+s2 then
- begin
- Tree.Items[i].Selected:=true;
- break;
- end;//end for
- end;//end if
- end;//--1
- procedure Tsz_kw.RefreshExecute(Sender: TObject);
- begin
- dm.sz_kw.Close;
- dm.sz_kw.CommandText:='select * from sz_kw';
- dm.sz_kw.Open;
- if dm.sz_kw.RecordCount<>0 then
- begin
- Add1.Enabled:=true;xiugai.Enabled:=true;Dele1.Enabled:=true;
- save1.Enabled:=false;A1.Enabled:=true;E1.Enabled:=true;D1.Enabled:=true;
- end
- else
- begin
- Add1.Enabled:=true;xiugai.Enabled:=false;Dele1.Enabled:=false;
- save1.Enabled:=false;A1.Enabled:=true;E1.Enabled:=false;D1.Enabled:=false;
- end;
- end;
- procedure Tsz_kw.FormShow(Sender: TObject);
- begin
- dm.sz_kw.Close;
- dm.sz_kw.CommandText:='select * from sz_kw';
- dm.sz_kw.Open;
- dm.xt_lbjs.Close;
- dm.xt_lbjs.CommandText:='select lbjs_sm,lb_dmgz from xt_lbjs where lb_dm='+''''+'sz_kw'+''''+'';
- dm.xt_lbjs.Open;
- //-----------------------------------------------
- lbjs_sm:=dm.xt_lbjs.fieldbyname('lbjs_sm').AsString;
- lb_dmgz:=dm.xt_lbjs.fieldbyname('lb_dmgz').asstring;
- edit1.Text:=lb_dmgz;
- loadTree(dm.sz_kw);//初始化树
- dm.sz_kw.Close;
- dm.sz_kw.CommandText:='select * from sz_kw';
- dm.sz_kw.Open;
- end;
- procedure Tsz_kw.dbEdit1KeyPress(Sender: TObject; var Key: Char);
- begin
- if key=#13 then
- begin
- key:=#0;
- SelectNext(ActiveControl,true,true);
- end;
- end;
- procedure Tsz_kw.DbEdit2KeyPress(Sender: TObject; var Key: Char);
- begin
- dbedit1keypress(nil,key);
- end;
- procedure Tsz_kw.TreeClick(Sender: TObject);
- var
- s1,s2:string;
- i,Epos:integer;
- begin
- if tree.selected=nil then
- exit
- else
- if Tree.Items[0].HasChildren<>false then
- begin //选中和不选中的图片显示
- for i:=0 to Tree.items.count-1 do
- begin
- Tree.Items[i].ImageIndex:=0;
- Tree.Items[i].SelectedIndex:=1;
- s1:=Tree.Selected.Text;
- Epos:=pos('-',s1);
- s2:=copy(s1,0,Epos-1);
- dm.sz_kw.Close;
- dm.sz_kw.CommandText:='select * from sz_kw where kw_dm='+''''+s2+''''+'';
- dm.sz_kw.Open;
- dbedit1.Text:=dm.sz_kw.fieldbyname('kw_dm').AsString;
- dbedit2.Text:=dm.sz_kw.fieldbyname('kw_mc').AsString;
- dbedit3.Text:=dm.sz_kw.fieldbyname('kw_js').AsString;
- dbedit4.Text:=dm.sz_kw.fieldbyname('kw_sm').AsString;
- end;
- end;
- end;
- procedure Tsz_kw.TreeChange(Sender: TObject; Node: TTreeNode);
- begin
- if dsState='add' then
- if application.MessageBox('请输入数据','提示',mb_okcancel+mb_iconinformation)=idOk then
- //dbedit1.SetFocus
- add.Execute
- else
- begin
- BtnState();//确定按钮变回来
- end;
- end;
- procedure Tsz_kw.N5Click(Sender: TObject);
- begin
- tree.Selected.Expand(true);
- end;
- procedure Tsz_kw.N6Click(Sender: TObject);
- begin
- tree.Selected.Collapse(true);
- end;
- end.