Procedure

TfrmDrawers.btnFindClick

Module

fDrawers

Last Modified

7/15/2014 3:26:36 PM

Visibility

Public/Published

Owner

TfrmDrawers

Declaration

procedure btnFindClick(Sender: TObject);

Calls Hierarchy


TfrmDrawers.btnFindClick
 ├FindTemplate
 │ └TfrmFindingTemplates.Find
 │   └SearchMatch
 └TfrmDrawers.SetFindNext

Calls

Name Declaration Comments
FindTemplate function FindTemplate(SearchString: string; Tree: TTreeView; OwningForm: TForm; StartNode: TTreeNode; IsNext, IgnoreCase, WholeWords: boolean): TTreeNode; -
TfrmDrawers.SetFindNext procedure SetFindNext(const Value: boolean); -


Source

987   procedure TfrmDrawers.btnFindClick(Sender: TObject);
988   var
989     Found, TmpNode: TTreeNode;
990     IsNext: boolean;
991   
992   begin
993     if(edtSearch.text <> '') then
994     begin
995       IsNext := ((FFindNext) and assigned (FLastFoundNode));
996       if IsNext then
997         TmpNode := FLastFoundNode
998       else
999         TmpNode := tvTemplates.Items.GetFirstNode;
1000      FInternalExpand := TRUE;
1001      FInternalHiddenExpand := TRUE;
1002      try
1003        Found := FindTemplate(edtSearch.Text, tvTemplates, Application.MainForm, TmpNode,
1004                              IsNext, not cbMatchCase.Checked, cbWholeWords.Checked);
1005      finally
1006        FInternalExpand := FALSE;
1007        FInternalHiddenExpand := FALSE;
1008      end;
1009  
1010      if assigned(Found) then
1011      begin
1012        FLastFoundNode := Found;
1013        SetFindNext(TRUE);
1014        FInternalExpand := TRUE;
1015        try
1016          tvTemplates.Selected := Found;
1017        finally
1018          FInternalExpand := FALSE;
1019        end;
1020      end;
1021    end;
1022    edtSearch.SetFocus;
1023  end;