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. If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders. However, you will need to update the sample to point to the location of the data once you have extracted all the files.

  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.


Download the files for Java
tocbean/EditTOCLabels.java Main class




Development licensing Deployment licensing
Engine Developer Kit Engine Runtime
ArcView
ArcEditor
ArcInfo