Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted

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.

share|improve this answer
    
+1 good explanation. See Brian Floods' code here: forums.esri.com/… –  Kirk Kuykendall Feb 17 '11 at 20:02
    
Thanks a lot guys! –  user1973 Feb 21 '11 at 10:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.