I am creating a template for ArcGis JTX. This is a mxd file, with a vba onload event handler which removes some functionality from vanilla ArcMap.

I'm stumped on one problem: double clicking on a featurelayer opens a layer properties screen. I'd like to disable that functionality.

An ideal solution would be to replace the command itself with an ICommand that shows a messagebox with the text "Disabled by administrator"

Another (less than ideal) solution would be to remove the ICommand from the ICommandsCollection, but I haven't found such an object in the documentation.

As an alternative, I'd replace the doubleclick eventhandler from the featurelayer, disable shortcuts and remove buttons from toolbars and menus. It's a lot of programming, and I have yet to learn how to replace the eventhandler.

Do you have any idea if one of these solutions can be done?

tl;dr: I need a function DisableCommand(UID) in an mxd with vba.


The double click is unfortunately not tied to a command, but is handled internally by the TOC contents view which displays a dialog with all property pages applicable to the active selected item. The same is done when selecting Properties.. in the context menu. There is no double click event readily available which you could subscribe to and stop its propagation.

The one way I could think of cannot be done with VBA, either. You would need to hook the TOC view window procedure and suppress double clicks when the selected item is a layer. This approach would need a fair amount of Win32 API programming and unfortunately cannot be done at all in VBA.

You could also try unregistering the Properties command from the appropriate COM component category ("Mx Commands"), but this would affect every ArcMap session, not only one single template. In addition, the user will probably still be able to open the dialog by double-clicking.

Your Answer

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