vcl-dxofficesearchbox-9b0bb094.md
The procedural type for single-time search result population events in TdxOfficeSearchBox editors.
TdxOfficeSearchBoxDropDownMenuPopulateEvent = procedure(Sender: TdxOfficeSearchBoxProperties; const ASearchText: string; ADropDownMenuItems: TdxBarItemLinks) of object;
| 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.
|
You can handle this event to customize the search result list.
A search result notification event occurs every time a TdxOfficeSearchBox editor adds the last visible search result to a drop-down menu.
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;
#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;
}
}
}
The TdxOfficeSearchBoxProperties.OnDropDownMenuPopulate event references the TdxOfficeSearchBoxDropDownMenuPopulateEvent procedural type.
See Also
TdxOfficeSearchBoxDropDownMenuItemAddedEvent Procedural Type
TdxOfficeSearchBoxDropDownMenuItemAddingEvent Procedural Type