Skip to main content

TdxOfficeSearchBoxProperties.OnDropDownMenuItemAdded Event

Allows you to execute custom code in response to individual search result addition operations.

Declaration

property OnDropDownMenuItemAdded: TdxOfficeSearchBoxDropDownMenuItemAddedEvent read; write;

Remarks

You can handle the OnDropDownMenuItemAdded event to execute custom code in response to individual search result addition operations. For example, you can customize search result appearance.

Event Occurrence

A search result notification event occurs every time a TdxOfficeSearchBox editor adds a search result to a drop-down menu.

Event Parameters

The following parameters are available within an OnDropDownMenuItemAdded event handler:

Sender
Provides access to settings (a TdxOfficeSearchBoxProperties class instance) of the TdxOfficeSearchBox editor that raised the search result notification event.
ASourceItem
Provides access to the bar item link associated with the UI command added to a drop-down menu.
ADropDownMenuItem
Provides access to the associated bar item link and allows you to customize its appearance settings.

Refer to the TdxOfficeSearchBoxDropDownMenuItemAddedEvent procedural type description for detailed information on all parameters accessible within an OnDropDownMenuItemAdded handler.

Code Example: Customize Search Result Appearance

The following code example changes the visible caption of a search result whose name or path includes 'Conditional' (Conditional Formatting, for example):

uses
  System.StrUtils,  // Declares the ContainsText global function
  dxOfficeSearchBox;  // Declares the TdxOfficeSearchBox class
// ...

procedure MyForm.dxOfficeSearchBox1PropertiesDropDownMenuPopulate(Sender: TdxOfficeSearchBoxProperties;
  ASourceItem: TObject; ADropDownMenuItem: TdxBarItemLink);
begin
  if ContainsText(ADropDownMenuItem.Caption, 'Conditional') then
    ADropDownMenuItem.UserCaption := 'Conditional Formatting Rule Management'
end;

VCL Bars: A Custom Search Result Caption in an Office Search Box

See Also