unit U_frameHelp10;

interface

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

type
  TfrmFrameHelp10 = class(TForm)
    ToolBar2: TToolBar;
    TOk: TToolButton;
    ToolButton7: TToolButton;
    cxDBTreeList1: TcxDBTreeList;
    ADOQueryHelp: TADOQuery;
    DataSource1: TDataSource;
    ADOConnection1: TADOConnection;
    cxDBTreeList1cxDBTreeListColumn2: TcxDBTreeListColumn;
    ImageList24: TImageList;
    cxStyleRepository1: TcxStyleRepository;
    cxStyle1: TcxStyle;
    cxStyle2: TcxStyle;
    cxStyle_gridRow: TcxStyle;
    cxStyle_gridFoot: TcxStyle;
    cxStyle_gridHead: TcxStyle;
    cxStyle_gridGroupBox: TcxStyle;
    cxStyle_yellow: TcxStyle;
    cxStyle_Red: TcxStyle;
    cxStyleTree: TcxStyle;
    cxStyle3: TcxStyle;
    procedure ToolButton7Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure TOkClick(Sender: TObject);
    procedure cxDBTreeList1DblClick(Sender: TObject);
  private
    procedure DoQuery();
  public
    fFrameNo:string;
    fFrameName:string;
    fAddress:String;
    frametop:string;
    fWhSql:String;
  end;

var
  frmFrameHelp10: TfrmFrameHelp10;

implementation
uses
  U_global;
{$R *.dfm}

procedure TfrmFrameHelp10.ToolButton7Click(Sender: TObject);
begin
  close;
end;

procedure TfrmFrameHelp10.FormCreate(Sender: TObject);
begin
  cxDBTreeList1.Align :=alClient;
  with ADOConnection1 do
  begin
    Connected:=false;
    ConnectionString:=gConString;
    Connected:=true;
  end;
end;
///////////////////////////////////////////////////////////
  //
///////////////////////////////////////////////////////////
procedure TfrmFrameHelp10.DoQuery();
begin
  with ADOQueryHelp do
  begin
    close;
    sql.Clear ;
    sql.Add('select * from YC_frame');
    sql.Add('where valid=''Y''');
    sql.Add('and frameLevel>=0');
    if trim(fFrameNo)<>'' then
    begin
      sql.Add('and frameNo like '+quotedStr('%'+fFrameNo+'%'));
    end;
    if trim(fFrameName)<>'' then
    begin
      sql.Add('and frameName like '+quotedStr('%'+fFrameName+'%'));
    end;
    if trim(fAddress)<>'' then
    begin
      sql.Add('and Address like '+quotedStr('%'+fAddress+'%'));
    end;
    if trim(frametop)<>'' then
    begin
      sql.Add('and frametop='+quotedStr(frametop));
    end;
    if Trim(fWhSql)<>'' then
      SQL.Add(fWhSql);
    sql.Add('order by frameLevel');
    Open;
  end;
end;

procedure TfrmFrameHelp10.FormShow(Sender: TObject);
begin
  DoQuery();
  cxDBTreeList1.Nodes[0].Expand(False);
end;

procedure TfrmFrameHelp10.TOkClick(Sender: TObject);
begin
  if ADOQueryHelp.IsEmpty then
     ModalResult:=-1
  else
    ModalResult:=1;
end;

procedure TfrmFrameHelp10.cxDBTreeList1DblClick(Sender: TObject);
begin
  tok.Click  ;
end;

end.