Class TSearchBar

Unit

Declaration

type TSearchBar = class(TPanel)

Description

This class implements a Mozilla like search bar

You can use it this way:

SearchBar:=TSearchBar.create(self);  //replace self with the control which should contain the search bar
SearchBar.Parent:=self;              //the search bar is automatically placeted at the bottom (align)
SearchBar.OnSearch:=SearchBarSearch; //this must be an event handler which is than called whenever something should be searched

Hierarchy

Overview

Methods

Public procedure SetFocus; override;
Public constructor Create(TheOwner: TComponent); override;
Public destructor destroy(); override;

Properties

Public property SearchText: string read GetSearchText;
Public property SearchLocation: longint read GetSearchLocation write SetSearchLocation;
Public property SearchLocations: TStrings read GetSearchLocations;
Public property Highlighting: boolean read GetHighlighting;
Public property FindState: TFindState read FFindState write SetFindState;
Published property OnSearch: TSearchEvent read FOnSearch write FOnSearch;
Published property OnClose: TNotifyEvent read FOnClose write FOnClose;
Published property OnShow: TNotifyEvent read FOnShow write FOnShow;
Published property OnHighlightChanged: TNotifyEvent read FHighlightChanged write FHighlightChanged;
Published property OnKeyDown;
Published property SubComponents: TSearchBarSubControls read FSubComponents write SetSubComponents;
Published property Caption: string read FCaption write SetCaption;
Published property SearchForwardText: string read FSearchForwardText write SetSearchForwardText;
Published property SearchBackwardText: string read FsearchBackwardText write SetsearchBackwardText;
Published property HighlightText: string read FHighlightText write SetHighlightText;
Published property FoundColor: TColor read FFoundColor write FFoundColor;
Published property NotFoundColor: TColor read FNotFoundColor write FNotFoundColor;
Published property NotFoundState: string read FNotFoundState write FNotFoundState;
Published property LoopAroundState: string read FLoopAroundState write FLoopAroundState;

Description

Methods

Public procedure SetFocus; override;

focuses the search text edit

Public constructor Create(TheOwner: TComponent); override;
 
Public destructor destroy(); override;
 

Properties

Public property SearchText: string read GetSearchText;

This is the text to search, entered by the user

Public property SearchLocation: longint read GetSearchLocation write SetSearchLocation;

Currently selected combobox item

Public property SearchLocations: TStrings read GetSearchLocations;

ComboBox-items

Public property Highlighting: boolean read GetHighlighting;

State of the highlight all button

Public property FindState: TFindState read FFindState write SetFindState;

Set this to the result of the search operation

Published property OnSearch: TSearchEvent read FOnSearch write FOnSearch;

This is called when the text should be searched, e.g. when the user clicks the buttons or types in the edit control

Published property OnClose: TNotifyEvent read FOnClose write FOnClose;

This is called when the search bar is closed (close button, or escape key)

Published property OnShow: TNotifyEvent read FOnShow write FOnShow;

This is called when the search bar is opened (setvisible/show)

Published property OnHighlightChanged: TNotifyEvent read FHighlightChanged write FHighlightChanged;

Called when the highlight button is pressed

Published property OnKeyDown;

Typical OnKeyDown-event. Setting key:=0, will prevent the default handling

Published property SubComponents: TSearchBarSubControls read FSubComponents write SetSubComponents;

This is a set specifies which sub components should be created
The default is [fscCloseButton, fscCaption, fscSearchForward, fscSearchBackwards, fscStatus]

See also
TSearchBarSubControl
Published property Caption: string read FCaption write SetCaption;

Caption of the search bar (needs fscCaption)

Published property SearchForwardText: string read FSearchForwardText write SetSearchForwardText;

Caption of the button for forward search (needs fscSearchForward)

Published property SearchBackwardText: string read FsearchBackwardText write SetsearchBackwardText;

Caption of the backward button (needs fscSearchBackwards)

Published property HighlightText: string read FHighlightText write SetHighlightText;

Caption of the highlight all button (needs fscHighlight)

Published property FoundColor: TColor read FFoundColor write FFoundColor;

Background-color of the edit control when the text is found

Published property NotFoundColor: TColor read FNotFoundColor write FNotFoundColor;

Background-color of the edit control when the text is not found

Published property NotFoundState: string read FNotFoundState write FNotFoundState;

Text to display when the text is not found (needs fscStatus)

Published property LoopAroundState: string read FLoopAroundState write FLoopAroundState;

Text to display when the text has only been found after looping around (needs fscStatus)


Generated by PasDoc 0.16.0.