OnBeforeReplaceItem(Sender: Object; Args: IMetaAttributeBreadcrumbReplaceItemEventArgs);
Sender. The parameter that returns the component that generated the event.
Args. The parameter that enables the user to determine event parameters.
The OnBeforeReplaceItem event occurs before component elements are replaced.
One can check replaced elements in this event, using property of the IMetaAttributeBreadcrumbReplaceItemEventArgs.Attribute argument. Set the IBreadcrumbActionItemEventArgs.Allow property to corresponding value to allow or deny replacing of elements.
Executing the example requires a form with the Button1 button and the MetaAttributesBreadcrumb component named MetaAttributesBreadcrumb1. This component is connected to any time series database. The specified procedure is set for MetaAttributesBreadcrumb1 as a handler of the OnBeforeReplaceItem event.
Sub MetaAttributesBreadcrumb1OnBeforeReplaceItem(Sender: Object; Args: IMetaAttributeBreadcrumbReplaceItemEventArgs);
Var
Item: IMetaAttributeBreadcrumbItem;
Begin
Item := Args.Item As IMetaAttributeBreadcrumbItem;
If (Item.MetaAttribute.Id = "DL") And (Args.Attribute = "COUNTRY") Then
Args.Allow := False;
End If;
End Sub MetaAttributesBreadcrumb1OnBeforeReplaceItem;
When the event occurs, attribute identifiers are checked. If replaceable element corresponds to an attribute with the DL identifier, and the user tries to replace it by an attribute with the COUNTRY identifier, substitution is denied.
See also: