unit SearchFme; interface uses SearchDm, Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ZjGridDBA, ZJGrid, JimLabels; type TSearchFrame = class(TFrame) zaSearchResult: TZjGridDBA; pnlTitle: TPanel; labTitle: TJimGradLabel; pnlSearch: TPanel; pnlSearchType: TPanel; gbType: TGroupBox; rbOverRange: TRadioButton; rbCommon: TRadioButton; pnlSearchKey: TPanel; edtKeyword: TEdit; btnSearch: TButton; pnlSearchResult: TPanel; zgSearchResult: TZJGrid; rbBelowRange: TRadioButton; procedure rbCommonClick(Sender: TObject); procedure btnSearchClick(Sender: TObject); procedure zgSearchResultMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); private FSearchData: TSearchData; FLocateType: TLocateType; public constructor Create(AParent: TFrame; ASearchData: TSearchData); destructor Destroy; override; property LocateType: TLocateType read FLocateType write FLocateType; end; implementation {$R *.dfm} { TSearchFrame } constructor TSearchFrame.Create(AParent: TFrame; ASearchData: TSearchData); begin inherited Create(AParent); FSearchData := ASearchData; zaSearchResult.DataSet := FSearchData.cdsSearch; end; destructor TSearchFrame.Destroy; begin inherited; end; procedure TSearchFrame.rbCommonClick(Sender: TObject); begin edtKeyword.Enabled := rbCommon.Checked; if rbCommon.Checked then zaSearchResult.Column('Code').Width := 80 else zaSearchResult.Column('Code').Width := 0; end; procedure TSearchFrame.btnSearchClick(Sender: TObject); begin if rbCommon.Checked then FSearchData.SearchKeyword(edtKeyword.Text) else if rbOverRange.Checked then FSearchData.SearchOverRange else if rbBelowRange.Checked then FSearchData.SearchBelowRange; end; procedure TSearchFrame.zgSearchResultMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin if (Button = mbLeft) and (ssDouble in Shift) then FSearchData.LocateCurrent(LocateType); end; end.