Back to Devexpress

TdxOfficeSearchBoxDropDownMenuPopulateEvent Type

vcl-dxofficesearchbox-9b0bb094.md

latest3.7 KB
Original Source

TdxOfficeSearchBoxDropDownMenuPopulateEvent Type

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

Declaration

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

Parameters

NameTypeDescription
SenderTdxOfficeSearchBoxProperties

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):

delphi
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;
cpp
#include "System.StrUtils.hpp" // Declares the ContainsText global function
#include "dxOfficeSearchBox.hpp" // Declares the TdxOfficeSearchBox class
// ...

void __fastcall TMyForm::dxOfficeSearchBox1PropertiesDropDownMenuItemPopulate(
  TdxOfficeSearchBoxProperties *Sender, const UnicodeString ASearchText, TdxBarItemLinks *ADropDownMenuItems)
{
  for(int i = 0; i < ADropDownMenuItems->Count; i++) // Iterates through all search results
  {
    if(ContainsText(ADropDownMenuItems->Items[i]->Caption, "Conditional"))
    {
      ADropDownMenuItems->Delete(i); // Deletes the matching search result
      break;
    }
  }
}

Direct TdxOfficeSearchBoxDropDownMenuPopulateEvent Type Reference

The TdxOfficeSearchBoxProperties.OnDropDownMenuPopulate event references the TdxOfficeSearchBoxDropDownMenuPopulateEvent procedural type.

See Also

TdxOfficeSearchBoxDropDownMenuItemAddedEvent Procedural Type

TdxOfficeSearchBoxDropDownMenuItemAddingEvent Procedural Type

dxOfficeSearchBox Unit