TdxOfficeSearchBoxDropDownMenuItemAddingEvent Type
The procedural type for search result population events in TdxOfficeSearchBox editors.
Declaration
TdxOfficeSearchBoxDropDownMenuItemAddingEvent = procedure(Sender: TdxOfficeSearchBoxProperties; const ASearchText: string; ASourceItem: TObject; var AAllow: Boolean) 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). |
ASourceItem | TObject | Provides access to the bar item link associated with the UI command that is about to appear in a drop-down menu. Tip Cast the returned object to the TdxBarItemLink class to access all public API members of the target bar item link. |
AAllow | Boolean |
|
Remarks
A search result population event in an Office Search Box editor allows you to exclude certain UI elements (disabled commands, for example) from a search result list displayed in a drop-down menu.
Event Occurrence
A search result population event occurs every time a TdxOfficeSearchBox editor is about to add a search result to a drop-down menu.
Code Example: Exclude Disabled Commands from Search Results
The following code example excludes disabled UI commands from search results:
uses
dxOfficeSearchBox; // Declares the TdxOfficeSearchBox class
// ...
procedure MyForm.dxOfficeSearchBox1PropertiesDropDownMenuItemAdding(Sender: TdxOfficeSearchBoxProperties;
const ASearchText: string; ASourceItem: TObject; var AAllow: Boolean);
var
AItem: TdxBarItemLink;
begin
if ASourceItem is TdxBarItemLink then
begin
AItem := ASourceItem as TdxBarItemLink;
if not AItem.Item.Enabled then
AAllow := False; // Hides the currently processed UI command if it is disabled
end;
end;
Direct TdxOfficeSearchBoxDropDownMenuItemAddingEvent Type Reference
The TdxOfficeSearchBoxProperties.OnDropDownMenuItemAdding event references the TdxOfficeSearchBoxDropDownMenuItemAddingEvent
procedural type.