unit U_XcCodeHelp;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, CheckLst, Buttons, DB, ADODB, cxStyles, cxCustomData,
  cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, cxDBData,
  cxDropDownEdit, cxGridLevel, cxGridCustomTableView, cxGridTableView,
  cxGridDBTableView, cxClasses, cxControls, cxGridCustomView, cxGrid;

type
  TfrmXcCodeHelp = class(TForm)
    ADOQueryHelp: TADOQuery;
    btOk: TBitBtn;
    btNo: TBitBtn;
    dbGrid1: TcxGrid;
    Tv1: TcxGridDBTableView;
    Tv1code: TcxGridDBColumn;
    Tv1Name: TcxGridDBColumn;
    dbGrid1Level1: TcxGridLevel;
    DataSource1: TDataSource;
    procedure btNoClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure btOkClick(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure Tv1DblClick(Sender: TObject);
  private
    procedure InitData();
  public
    Fflag:string;  //类型标志
    fDivChar:string;
    pColumns:integer;
    fSelResult:string;
  end;

var
  frmXcCodeHelp: TfrmXcCodeHelp;

implementation

{$R *.dfm}

procedure TfrmXcCodeHelp.btNoClick(Sender: TObject);
begin
  ModalResult:=-1;
end;

procedure TfrmXcCodeHelp.FormCreate(Sender: TObject);
begin

end;
////////////////////////////////////////////////
  //函数：
////////////////////////////////////////////////
procedure TfrmXcCodeHelp.InitData();
begin
  with ADOQueryHelp do
  begin
    close;
    sql.clear;
    sql.Add('select * from XC_code');
    sql.Add('where flag='''+Fflag+'''');
    sql.Add('and Valid=''Y''');
    sql.Add('order by code');
    Open;
  end;

end;
procedure TfrmXcCodeHelp.FormShow(Sender: TObject);
begin
  self.Caption :='输入帮助(类别：'+FFlag+')';
  InitData();
end;

procedure TfrmXcCodeHelp.btOkClick(Sender: TObject);
begin
  if ADOQueryHelp.IsEmpty then exit;
  ModalResult:=1;
end;

procedure TfrmXcCodeHelp.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  Action:=caFree;
end;

procedure TfrmXcCodeHelp.Tv1DblClick(Sender: TObject);
begin
  btOk.Click ;
end;

end.
