IMetabaseListView.SelectElem

Fore Syntax

SelectElem(Object: IMetabaseObjectDescriptor, [Focus: Boolean = False]);

Fore.NET Syntax

SelectElem(Object: Prognoz.Platform.Interop.Metabase.IMetabaseObjectDescriptor, Focus: Boolean);

Parameters

Object. Description of repository object.

Focus. Indicates whether to focus element.

Description

The SelectElem method selects a component element corresponding to the repository object with the specified description.

Comments

If the component enables multiple selection, the element will be added to the list of already selected elements.

Fore Example

Executing the example requires a form, a button with the Button1 identifier on this form, the MetabaseListView component with the MetabaseListView1 identifier. Any repository folder is selected in the Root property of the MetabaseListView component.

Add links to the ExtCtrls, Metabase system assemblies.

The example is the OnClick event handler for the Button1 component.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    Descs: IMetabaseObjectDescriptors;
    Desc: IMetabaseObjectDescriptor;
Begin
    
// Get repository object description
    Desc := MetabaseListView1.GetItemObject(MetabaseListView1.Items.Item(1As IMetabaseListViewItem);
    
// Select the element which corresponds to the repository object with the specified description
    MetabaseListView1.SelectElem(Desc);
    Descs := MetabaseListView1.SelectedObjects;
    
// Display the number of objects in the selected folder and selected objects to the console
    Debug.WriteLine("Total objects: " + MetabaseListView1.Items.Count.ToString);
    Debug.WriteLine(
"Selected objects: " + MetabaseListView1.SelectedCount.ToString);
    Debug.Indent;
    
For Each Desc In Descs Do
        Debug.WriteLine(Desc.Name + 
" (" + Desc.Id + ')');
    
End For;
    Debug.Unindent;
End Sub Button1OnClick;

After executing the example two first elements in the component will be selected, the console window will display: the number of elements in the selected folder, the number of selected elements, names and identifiers of selected components.

Fore.NET Example

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.ExtCtrls;

Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
    Descs: IMetabaseObjectDescriptors;
    Desc: IMetabaseObjectDescriptor;
Begin
    
// Get repository object description
    Desc := MetabaseListViewNet1.CtrlBox.GetItemObject(MetabaseListViewNet1.CtrlBox.Items.Item[1As IMetabaseListViewItem);
    
// Select the element which corresponds to the repository object with the specified description
    MetabaseListViewNet1.CtrlBox.SelectElem(Desc, True);
    Descs := MetabaseListViewNet1.SelectedObjects;
    
// Display the number of objects in the selected folder and selected objects to the console
    System.Diagnostics.Debug.WriteLine("Total objects: " + MetabaseListViewNet1.CtrlBox.Items.Count.ToString());
    System.Diagnostics.Debug.WriteLine(
"Selected objects: " + MetabaseListViewNet1.CtrlBox.SelectedCount.ToString());
    System.Diagnostics.Debug.Indent();
    
For Each Desc In Descs Do
        System.Diagnostics.Debug.WriteLine(Desc.Name + 
" (" + Desc.Id + ')');
    
End For;
    System.Diagnostics.Debug.Unindent();
End Sub;

See also:

IMetabaseListView