Edit TOC labels


Purpose
This sample demonstrates how to edit labels in the TOC control. The TabStrip control's Click event is used to determined whether the TOC control Buddy property is set to either the Map control or the PageLayout control. The ActiveView of the Buddy property is used by the TOC control to populate itself.
The LabelEdit property is used to determine whether labels can be edited unchecked (automatic) or whether the OnBeginLabelEdit and OnEndLabelEdit events are triggered (manual). If label editing is set to manual, the getSelectedItem method is used in the OnBeginLabelEdit event to determine the type of label being edited.
In this sample, only layer labels can be edited. The OnEndLabelEdit event ensures that there are no empty layer labels.

How to use

See How to use ArcGIS samples for help on running the sample.

  1. Run the EditTOCLabels application and load the data as outlined for your chosen language.
  2. Toggle the visibility of data layers in the TOC control.
  3. Toggle between the Map control and the PageLayout control. The buddy changes and the TOC control updates itself.
  4. Edit the TOC control labels by clicking a label, then clicking it a second time to invoke label editing. (You can press the ESC key on the keyboard during the edit session to cancel the label edit.)
  5. Run the application again.
  6. Click the Load Document button, and browse your file system for an MXD or PMF file with which to work.

If you installed the samples feature, you will find the files associated with this sample in <Your Developer Kit install location>\DeveloperKit10.4\Java\Samples\ArcObjects.

tocbean/EditTOCLabels.java Main class




Development licensing Deployment licensing
Engine Developer Kit Engine
ArcGIS for Desktop Basic
ArcGIS for Desktop Standard
ArcGIS for Desktop Advanced