com.esri.arcgis.controls
Interface ITOCControl2

All Superinterfaces:
ITOCControl, Serializable
All Known Implementing Classes:
ITOCControl2Proxy, TOCControl

public interface ITOCControl2
extends ITOCControl, Serializable

Provides access to members that control the TOCControl.

Description

The ITOCControl2 interface provides additional members for tasks related to the TOCControl, such as enabling the drag and drop of layers and working with selected items.

Product Availability

Available with ArcGIS Engine.


Method Summary
 void getSelectedItem(int[] itemType, IBasicMap[] basicMap, ILayer[] layer, Object[] unk, Object[] data)
          Returns the selected item in the TOCControl.
 boolean isEnableLayerDragDrop()
          Indicates if layers can be dragged and dropped in the control.
 void selectItem(Object unk, Object data)
          Sets the selected item in the TOCControl.
 void setEnableLayerDragDrop(boolean newVal)
          Indicates if layers can be dragged and dropped in the control.
 
Methods inherited from interface com.esri.arcgis.controls.ITOCControl
aboutBox, esri_isEnabled, esri_setEnabled, getActiveView, getAppearance, getBorderStyle, getBuddy, getCustomProperty, getHWnd, getKeyIntercept, getLabelEdit, getLayerVisibilityEdit, getMouseIcon, getMousePointer, getObject, hitTest, setActiveView, setAppearance, setBorderStyle, setBuddyControl, setCustomProperty, setKeyIntercept, setLabelEdit, setLayerVisibilityEdit, setMouseIconByRef, setMousePointer, update
 

Method Detail

isEnableLayerDragDrop

boolean isEnableLayerDragDrop()
                              throws IOException,
                                     AutomationException
Indicates if layers can be dragged and dropped in the control.

Description

Determines whether layers can be dragged and dropped in the TOCControl. This property if false by default. When EnableLayerDragDrap is true, layers can be dragged and dropped as follows:

By default when dragging and dropping a layer within a map, the layer will be moved within the map to the drop location. To copy the layer, rather than move it press the CTRL key while dragging and dropping.

By default when dragging and dropping a layer between maps, a copy of the layer will be added into the map the layer is dropped into. To move the dragged layer, rather than copy it press the CTRL key while dragging and dropping.

Remarks

Layers can not be dragged and dropped in the following cases:

Product Availability

Available with ArcGIS Engine.

Returns:
The newVal
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setEnableLayerDragDrop

void setEnableLayerDragDrop(boolean newVal)
                            throws IOException,
                                   AutomationException
Indicates if layers can be dragged and dropped in the control.

Product Availability

Available with ArcGIS Engine.

Parameters:
newVal - The newVal (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getSelectedItem

void getSelectedItem(int[] itemType,
                     IBasicMap[] basicMap,
                     ILayer[] layer,
                     Object[] unk,
                     Object[] data)
                     throws IOException,
                            AutomationException
Returns the selected item in the TOCControl.

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.

Product Availability

Available with ArcGIS Engine.

Parameters:
itemType - A com.esri.arcgis.controls.esriTOCControlItem constant (in/out: use single element array)
basicMap - A reference to a com.esri.arcgis.carto.IBasicMap (in/out: use single element array)
layer - A reference to a com.esri.arcgis.carto.ILayer (in/out: use single element array)
unk - A reference to another Object (IUnknown) (in/out: use single element array)
data - A Variant (in/out: use single element array)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

selectItem

void selectItem(Object unk,
                Object data)
                throws IOException,
                       AutomationException
Sets the selected item in the TOCControl.

Description

Selects the specified item in the TOCControl. The selected item will appear blue when the TOCControl has keyboard focus and grey when the TOCControl does not have keyboard focus.

Unk specifies an IMap object, and ILayer object or and 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.

To select an ILegendGroup::Heading either just pass an ILegendGroup object or pass an ILegendGroup object with an index of -1. To select a legend class within the LegendGroup pass an ILegendGroup object with a valid index.

Product Availability

Available with ArcGIS Engine.

Parameters:
unk - A reference to another Object (IUnknown) (in)
data - A Variant (in, optional, pass null if not required)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.