Skip to main content

TdxOfficeSearchBoxDropDownMenuPopulateEvent Type

The procedural type for single-time search result population events in TdxOfficeSearchBox editors.

Declaration

TdxOfficeSearchBoxDropDownMenuPopulateEvent = procedure(Sender: TdxOfficeSearchBoxProperties; const ASearchText: string; ADropDownMenuItems: TdxBarItemLinks) of object;

Parameters

Name Type Description
Sender TdxOfficeSearchBoxProperties

Provides access to settings of the TdxOfficeSearchBox editor that raised the search result population event.

ASearchText string

Returns the current user search query (the editor’s EditValue property value).

ADropDownMenuItems TdxBarItemLinks

A collection of bar item links that correspond to all displayed search results.

You can display found commands in a different container.

Remarks

You can handle this event to customize the search result list.

Event Occurrence

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

Code Example: Remove Specific Search Results

The following code example excludes the UI command whose caption includes 'Conditional' (Conditional Formatting, for example):

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

procedure MyForm.dxOfficeSearchBox1PropertiesDropDownMenuPopulate(Sender: TdxOfficeSearchBoxProperties;
  const ASearchText: string; ADropDownMenuItems: TdxBarItemLinks);
var
  I: Integer;
begin
  for I := 0 to ADropDownMenuItems.Count - 1 do  // Iterates through all search results
    if ContainsText(ADropDownMenuItems.Items[I].Caption, 'Conditional') then
    begin
      ADropDownMenuItems.Delete(I);  // Deletes the matching search result
      break;
    end;
end;

VCL Bars: A Search Result Exclusion Example

Direct TdxOfficeSearchBoxDropDownMenuPopulateEvent Type Reference

The TdxOfficeSearchBoxProperties.OnDropDownMenuPopulate event references the TdxOfficeSearchBoxDropDownMenuPopulateEvent procedural type.

See Also