SelectElementWithoutExcep(Element: Integer; Recursive: Boolean);
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, a button with the Button1 identifier on it, the UiDimension component with the UiDimension1 identifier, and the DimensionTree component with the DimensionTree1 identifier. UiDimension1 is set as a data source for DimensionTree1. A territory dictionary with the D_TO identifier located 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.
The requirements and result of the Fore.NET example execution match with those in the Fore Example. Use Fore.NET analogs instead of Fore components.
Imports Prognoz.Platform.Interop.Dimensions;
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
Inst: IDimInstance;
Attr: IDimAttribute;
AttrInst: IDimAttributeInstance;
i: uinteger;
Begin
Inst := UiDimensionNet1.DimInstance;
Attr := Inst.Dimension.Attributes.Name;
AttrInst := Inst.Attributes.FindByKey(Attr.Key);
i := AttrInst.LookupValue("Administrative Region Sverdlovsk");
DimensionTreeNet1.Selection.SelectElementWithoutExcep(i, False);
End Sub;
See also: