SelectElementWithoutExcep(Element: Integer; Recursive: Boolean);
Element. Index of the dictionary element to be added in the selection.
Recursive. Parameter determining whether child elements will be added to the selection. If True is sent, all child elements of the specified element will be added to the selection.
The SelectElementWithoutExcep method adds the specified element to selection without displaying messages about possible exceptions.
If any exception is thrown during selection, a warning message is not displayed. The selection will not be changed. To display a message about an exception, use the IDimSelection.SelectElement method.
Executing the example requires a form containing a button with the Button1 identifier, the UiDimension component with the UiDimension1 identifier and the DimensionTree component with the DimensionTree1 identifier. The data source of DimensionTree1 is UiDimension1. A territory dictionary with the D_TO identifier in the repository is connected to the UiDimension1 component.
The example is a handler of the OnClick event for the button.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
Inst: IDimInstance;
Attr: IDimAttribute;
AttrInst: IDimAttributeInstance;
i: Integer;
Begin
Inst := UiDimension1.DimInstance;
Attr := Inst.Dimension.Attributes.Name;
AttrInst := Inst.Attributes.FindByKey(Attr.Key);
i := AttrInst.LookupValue("Administrative Region Sverdlovsk");
DimensionTree1.Selection.SelectElementWithoutExcep(i, False);
End Sub Button1OnClick;
Clicking the button searches for an element with the specified named in the dictionary. The found element is added to the selection. If the element is not found, the selection is not changed.
See also: