U_fzlr_gcxmda.pas
上传用户:psxgmh
上传日期:2013-04-08
资源大小:15112k
文件大小:3k
源码类别:
Delphi/CppBuilder
开发平台:
Delphi
- unit U_fzlr_gcxmda;
- interface
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- Db, DBClient, ImgList, Buttons, ComCtrls, ExtCtrls;
- type
- TfrmGcxmdy_Fzlr = class(TForm)
- Panel1: TPanel;
- TreeView1: TTreeView;
- Panel2: TPanel;
- btnOK: TSpeedButton;
- btnCancel: TSpeedButton;
- ImageList1: TImageList;
- procedure btnOKClick(Sender: TObject);
- procedure btnCancelClick(Sender: TObject);
- procedure FormShow(Sender: TObject);
- procedure TreeView1DblClick(Sender: TObject);
- private
- { Private declarations }
- public
- procedure refresh;
- { Public declarations }
- end;
- var
- frmGcxmdy_Fzlr: TfrmGcxmdy_Fzlr;
- pub_gcxmmc: string;
- implementation
- uses U_mainform, WzglDB;
- {$R *.DFM}
- procedure TfrmGcxmdy_Fzlr.btnOKClick(Sender: TObject);
- begin
- pub_gcxmmc := treeview1.selected.text;
- close;
- end;
- procedure TfrmGcxmdy_Fzlr.btnCancelClick(Sender: TObject);
- begin
- close;
- end;
- procedure TfrmGcxmdy_Fzlr.refresh;
- var
- mynode_1, mynode_2, mynode_3, mynode_4: Ttreenode;
- s_bm_1, s_bm_2, s_bm_3, s_bm_4: string;
- s_mc_1, s_mc_2, s_mc_3, s_mc_4: string;
- begin
- treeview1.Items.clear;
- mynode_1 := treeview1.Items.Add(treeview1.topitem, '工程项目信息');
- mynode_1.imageindex := 0;
- mynode_1.stateindex := -1;
- mynode_1.selectedindex := 1;
- DM.CDS_GCXMDY_INDEX.indexfieldnames := '工程编码';
- DM.CDS_GCXMDY_INDEX.First;
- while not DM.CDS_GCXMDY_INDEX.Eof do
- begin
- s_bm_1 := DM.CDS_GCXMDY_INDEX.fieldbyname('工程编码').asstring;
- s_mc_1 := DM.CDS_GCXMDY_INDEX.fieldbyname('工程名称').asstring;
- if length(trim(s_bm_1)) = 4 then
- begin
- mynode_2 := treeview1.items.addchild(mynode_1, s_mc_1);
- mynode_2.imageindex := 0;
- mynode_2.stateindex := -1;
- mynode_2.selectedindex := 1;
- end;
- if length(trim(s_bm_1)) = 8 then
- begin
- mynode_3 := treeview1.items.addchild(mynode_2, s_mc_1);
- mynode_3.imageindex := 0;
- mynode_3.stateindex := -1;
- mynode_3.selectedindex := 1;
- end;
- if length(trim(s_bm_1)) = 13 then
- begin
- mynode_4 := treeview1.items.addchild(mynode_3, s_mc_1);
- mynode_4.imageindex := 0;
- mynode_4.stateindex := -1;
- mynode_4.selectedindex := 1;
- end;
- DM.CDS_GCXMDY_INDEX.next;
- end;
- end;
- procedure TfrmGcxmdy_Fzlr.FormShow(Sender: TObject);
- begin
- DM.CDS_GCXMDY_INDEX.Active := True;
- refresh;
- treeview1.TopItem.Selected := true;
- treeview1.FullExpand;
- end;
- procedure TfrmGcxmdy_Fzlr.TreeView1DblClick(Sender: TObject);
- begin
- btnOK.click;
- end;
- end.