IRdsDictionaryBox.FocusedElement

Syntax

FocusedElement: Integer;

Description

The FocusedElement property determines the key of the MDM dictionary focused element.

Comments

If the elements are not focused, the property returns the value -1. If the focus is on the root element, the property returns the value -2.

Example

Executing the example requires a form with the Button1 button, the RdsDictionaryBox component named RdsDictionaryBox1, and the UiRdsDictionary component that is a data source for RdsDictionaryBox1.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    Instance: IRdsDictionaryInstance;
    Attributes: IRdsAttributesInstance;
    Elements: IRdsDictionaryElements;
    Element: IRdsDictionaryElement;
    i, AttrKey, AttrKey1: Integer;
Begin
    i := RdsDictionaryBox1.FocusedElement;
    If i = -2 Then
        Debug.WriteLine("Dictionary root element that does not have definite attribute values is focused");
    Elseif i = -1 Then
        Debug.WriteLine("Focused element is absent");
    Else
        Instance := RdsDictionaryBox1.Source.Instance;
        Attributes := Instance.Attributes;
        Elements := Instance.Elements;
        Element := Elements.ItemElement(i);
        AttrKey := Attributes.FindById("NAME").Key;
        AttrKey1 := Attributes.FindById("ORD").Key;
        Debug.WriteLine(Element.Attribute(AttrKey));
        Debug.WriteLine(Element.Attribute(AttrKey1));
    End If;
End Sub Button1OnClick;

After executing the example on pressing the button, the attribute values Name and Order of a selected dictionary element displayed in the RdsDictionaryBox1 component are displayed in the console.

See also:

IRdsDictionaryBox