How do you remove tools or disable tools in a template?

693
7
10-12-2011 02:05 PM
GregRieck
Occasional Contributor III
Hello,

I have a line Feature Class in my map document. When the user selects the line template they are presented with the following tools to create the feature with: Line, Rectangle, Circle, Ellipse, and Freehand (see attached screen shot).

I would like to 1) remove all the tools except the Line tool or 2) disable all the tools except the Line tool. I've found IEditTemplate.Tool but I'm not clear on how to use this or if it is advisable to remove tools from a template.

I would appreciate some sample code showing how to manage the tools in a template. Also, if it's not possible to remove tools from a template can you provide suggestions for a work around.


[ATTACH=CONFIG]9482[/ATTACH]

G
0 Kudos
7 Replies
NeilClemmons
Regular Contributor III
I haven't done any work with ArcGIS 10 yet as our clients haven't upgraded so I may be wrong but I would think you would check the geometry type being edited inside your tool's Enabled event and set it accordingly.  At ArcGIS 9.3.1 and earlier you could check the editor's target layer to see what type of features it contains.
0 Kudos
GregRieck
Occasional Contributor III
Hello Neil and thank you for taking the time to look at this thread.

At 10 the geometry type defines the default tools available to a Create Feature Template. But what I'm looking for is a way to remove specific tools from the default list. There isn't an "enabled" event for tools at 10. For example I have a
Building Feature Class. As soon as I start an edit session that contains that building layer it's feature template is enabled with a list of default tools, see screen shot. It's this list of tools I want to manipulate. Specifically the problem is that the IEditTemplate.Tool looks for a GUID.

I'm looking for a programmatic way of examining all of the tools for a selected template and removing tools that I don't want the user to have available. 

[C#] public Guid Tool {get; set;}

I found another thread with some interesting information but no actual help on how to actually work with the tools.


[ATTACH=CONFIG]9489[/ATTACH]
0 Kudos
by Anonymous User
Not applicable
Unfortunately its not possible to customize the list of construction tools in the create features window. You can create and add your own to the existing list.

The IEditTemplate.Tool property sets the tool that will be enabled when the user selects that template.
0 Kudos
GregRieck
Occasional Contributor III
Unfortunately its not possible to customize the list of construction tools in the create features window. You can create and add your own to the existing list.

The IEditTemplate.Tool property sets the tool that will be enabled when the user selects that template.


Sean, thanks for responding.

That is really to bad. The existing tools are fine I don't see any need to create and add my own custom tool. And then that still wouldn't solve anything. The user is still free to pick a tool.

Is there a way to determine what tool is assigned as the default tool for the template and then programmatically change the default tool if it isn't an "approved" tool? I already have events in place for template change and I understand how to access and deal with changing default values. However, working with the "tools" of a template isn't very clear. There are several tools available for a given template. How do I determine what the GUID's are for all the possible templates and their tools and then limit the default tool for a template to a given tool?  Wow, that is deep!

Greg
0 Kudos
by Anonymous User
Not applicable
Customizing the construction tool list is something we'll consider for a future release...

In the mean time; IEditTemplate.Tool will contain the GUID of the default tool for that template. When the template is first created this defaults to whatever the internal default is for the layer type (point, poly, line etc). You can change this programmatically by setting this property to the GUID of any ArcMap tool, although one the construction tools for that layer type make the most sense. We dont expose this list but the tools for each construction type are registered in component categories, so you can use categories.exe (arcgis bin folder) to examine them. Scroll down the rather long list and look for the 'Esri Editor Polygon Feature Construction Tools' category, as an example, and the guid for each tool is shown at the bottom of the dialog.

Once you have the guid of the tool, you can then loop through the editor templates you wish to change and assign the new tool. IEditTemplate.Tool shows how to assign the guid while this example does something a little different.

Hope this helps.
0 Kudos
GregRieck
Occasional Contributor III
THANK YOU Sean.

I'm sure I can get something put together to get the behaviour I'm looking for. The comments and links you've provide will be very helpful and is what I was looking for. Thank you again.

Greg
0 Kudos
SandyReuther
New Contributor II
Hello,

does anybody know something, if removing construction tools programmatically is possible in 10.1 now? It's really annoying to give editors such an easy-to-see possibility to draw circles or freehand, if only simple polylines are allowed in your data definitons...

Many thanks for the information.
Sandy
0 Kudos