unit U_YPTypeHelp;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxGraphics, cxCustomData, cxStyles, cxTL, cxMaskEdit,
  cxInplaceContainer, cxDBTL, cxControls, cxTLData, DB, ADODB;

type
  TfrmYPTypeHelp = class(TForm)
    ADOConnection1: TADOConnection;
    cxDBTreeList1: TcxDBTreeList;
    cxDBTreeList1cxDBTreeListColumn2: TcxDBTreeListColumn;
    DataSource1: TDataSource;
    ADOQueryHelp: TADOQuery;
    procedure FormCreate(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure cxDBTreeList1DblClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmYPTypeHelp: TfrmYPTypeHelp;

implementation
uses
  U_DataLink;
{$R *.dfm}

procedure TfrmYPTypeHelp.FormCreate(Sender: TObject);
begin
  cxDBTreeList1.Align:=alclient;
  try
    with ADOConnection1 do
    begin
      Connected:=false;
      ConnectionString:=DConString;
      //ConnectionString:='';
      Connected:=true;
    end;
  except
  end;
end;

procedure TfrmYPTypeHelp.FormShow(Sender: TObject);
begin
  with ADOQueryHelp do
  begin
    Close;
    SQL.Clear;
    SQL.Add('select * from CP_Type order by CPlevel,CPOrder,CPName');
    Open;
  end;
  cxDBTreeList1.Items[0].Expand(false);
end;

procedure TfrmYPTypeHelp.cxDBTreeList1DblClick(Sender: TObject);
begin
  IF ADOQueryHelp.IsEmpty then exit;
  ModalResult:=1;
end;

end.
