TdxOfficeSearchBoxProperties.OnDropDownMenuPopulate Event
In This Article
Allows you to customize the search result list once it is populated.
#Declaration
Delphi
property OnDropDownMenuPopulate: TdxOfficeSearchBoxDropDownMenuPopulateEvent read; write;
#Remarks
You can handle the OndropDownMenuPopulate
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.
#Event Parameters
Sender
- Provides access to settings (a TdxOfficeSearchBoxProperties class instance) of the TdxOfficeSearchBox editor that raised the search result population event.
ASearchText
- Returns the current user search query (the editor’s EditValue property value).
ADropDownMenuItems
The collection of bar item links that correspond to all displayed search results.
Tip
You can use this parameter to access and customize the search result list.
Refer to the TdxOfficeSearchBoxDropDownMenuPopulateEvent procedural type for detailed information on all parameters accessible within an OnDropDownMenuPopulate
event handler.
#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, // This unit declares the ContainsText global function
dxOfficeSearchBox; // This unit 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;
See Also