3

Is there a way to set keyboard shortcuts to toggle layers on/off while editing?

For example F1 will turn on /off my top layer in my table of contents, F2 will toggle the 2nd layer, ect.

4

From Keyboard shortcuts in ArcMap these are the keyboard shortcuts available in ArcMap for use in the Table of Contents

Navigating the table of contents with the keyboard

  • F3 or clicking inside the table of contents puts the keyboard focus on the table of contents so you can navigate and interact with it.
  • ESC or clicking the map puts the keyboard focus on the map.
  • HOME selects the first item in the table of contents.
  • END selects the last item in the table of contents.
  • PAGE UP or PAGE DOWN arrows move through the items in the table of contents.
  • Left/Right arrows or the + and - keys expand or collapse selected items. They also toggle among the tabs at the bottom of the table of contents when they have keyboard focus.
  • SPACE turns drawing of the selected layers on or off.
  • CTRL+SPACE turns all the layers in the data frame on or off when a single layer is selected in the table of contents. If the selected layer is part of a group layer or a composite layer, such as an ArcIMS image service layer, all the members of that layer will be turned on or off. If multiple layers are selected, CTRL+SPACE works like SPACE by itself and toggles only the selected layers on or off.
  • F2 renames the selected item.
  • F12 or ENTER opens the selected item's properties dialog box. If the currently selected item is a heading, symbol, or label, the Layer Properties dialog box will open with the Symbology tab shown on top.
  • SHIFT+F10 (or the Application key, if your keyboard has one) opens the shortcut menu for the selected item.
  • Use SHIFT+F1 or F1 to obtain context help when an item has keyboard focus or when the properties dialog box tab or a table of contents tab is selected.
  • F11 activates a selected data frame, or hold down ALT and click a data frame to activate it.
  • When there are multiple data frames in the map, use CTRL+TAB to cycle through each data frame and activate it.

It doesn't appear that there is a way to selectively turn layers on/off using the keyboard, however you could use a combination of F3, Page Up, Page Down, and SPACE etc. to enter the TOC, move up and down, and turn on/off as required.

  • 1
    Is there a possibility to write a script via ArcGIS API to assign a shortcut to turn on/off a specific layer? There might be some way! Maybe through macros (although it is no longer supported by Esri) or system calls. – Vladimir May 17 '17 at 14:17
  • @Vladimir definitely - I had an add-in years ago that turned on/off a raster layer, and even added it if the layer wasn't present. This was an arcobjects add-in, not python. – Midavalo May 17 '17 at 14:29
  • @Midavalo If you ever come across that arcobject add in that can accomplish this, please message me. I've been google'ing with no luck and i'm not a programmer by any means. – Tigerwoulds May 17 '17 at 17:47
  • @Tigerwoulds It was a very specific add-in I had created in-house specifically for the layer concerned. The layer name or data source was hard-coded into the add-in so without modification to the code it wouldn't be of any use to you I think. Unfortunately I no-longer work for that organisation so I can't get the add-in or the code to pass it on. – Midavalo May 17 '17 at 17:50
  • @Midavalo Ah, no worries! Thanks anyways, at least now I know it's possible. – Tigerwoulds May 17 '17 at 18:09
0

I wrote an AutoHotkey script for this. The first variant sent mouse clicks to the check boxes, but only works if you have the same layers in the same spot all the time.

My latest version uses the FindText utility (which searches for images and text) to select the layer in question, then send appropriate keystrokes (space- to activate or deactivate the layer, followed by home-reset the position in the table of contents).

I love using AHK because you can have global hotkeys and manipulate any program to year heart's content. Powerful stuff.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.