This document is archived and information here might be outdated.  Recommended version.


ITOCControl2.GetSelectedItem Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Controls > ESRI ArcGIS Controls > Interfaces > IT > ITOCControl2 Interface > ITOCControl2.GetSelectedItem Method
ArcGIS Developer Help

ITOCControl2.GetSelectedItem Method

Returns the selected item in the TOCControl.

[Visual Basic .NET]
Public Sub GetSelectedItem ( _
    ByRef ItemType As esriTOCControlItem, _
    ByRef BasicMap As IBasicMap, _
    ByRef Layer As ILayer, _
    ByRef Unk As Object, _
    ByRef Data As Object _
)
[C#]
public void GetSelectedItem (
    ref esriTOCControlItem ItemType,
    ref IBasicMap BasicMap,
    ref ILayer Layer,
    ref object Unk,
    ref object Data
);
[C++]
HRESULT GetSelectedItem(
  esriTOCControlItem* ItemType,
  IBasicMap** BasicMap,
  ILayer** Layer,
  IUnknown Pointer* Unk,
  Variant* Data
);
[C++]
Parameters
ItemType [in, out]

ItemType is a parameter of type esriTOCControlItem* BasicMap [in, out]
BasicMap is a parameter of type IBasicMap** Layer [in, out]
Layer is a parameter of type ILayer** Unk [in, out]
Unk is a parameter of type IUnknown* Data [in, out]
Data is a parameter of type VARIANT*

Product Availability

Available with ArcGIS Engine.

Description

Returns the selected item in the TOCControl. The selected item may have been selected interactively by the end user clicking on the TOCControl or programmatically using the SelectItem method.

ItemType specifies an enumeration indicating the type of item (none, map, layer, heading or legend class).

Map specifies an IMap object.

Layer specifies an ILayer object.

Unk specifies an ILegendGroup object.

Data specifies a long indicating the index of the legend class within the legend group. Use this index in conjunction with the legend group to obtain a particular legend class. An index of -1 refers to the heading if it is present.

[C#]
IBasicMap map = null;
ILayer layer = null;
Object other = null;
Object index = null;
esriTOCControlItem item = esriTOCControlItem.esriTOCControlItemNone;

axTOCControl1.GetSelectedItem(ref item, ref map, ref layer, ref other, ref index);

[Visual Basic .NET]
Dim pMap As IMap = Nothing
Dim pLayer As ILayer = Nothing
Dim pOther As Object = Nothing
Dim pItem As esriTOCControlItem
Dim pIndex As Object = Nothing

AxTOCControl1.GetSelectedItem(pItem, pMap, pLayer, pOther, pIndex)

See Also

ITOCControl2 Interface