Problem adding toolbar control into dockable window

1774
6
Jump to solution
06-27-2012 04:43 AM
Highlighted
Occasional Contributor
Hello!

I want to add a toolbar control into my dockable window and add standard select tools of ArcMap into this toolbar control.
Otherwise I need that, standard select tools be in my dockable window.
How can I do this?
Can anyone give me an idea?

Thanks!
Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
Regular Contributor III
Add a standard .NET toolbar to your form and create buttons for the tools you want.  Inside the button click events, get references to the tools you want (via IDocument.CommandBars.Find) and set them to be the current tool (via IApplication.CurrentTool).

View solution in original post

Reply
0 Kudos
6 Replies
Highlighted
Regular Contributor III
Add a standard .NET toolbar to your form and create buttons for the tools you want.  Inside the button click events, get references to the tools you want (via IDocument.CommandBars.Find) and set them to be the current tool (via IApplication.CurrentTool).

View solution in original post

Reply
0 Kudos
Highlighted
Occasional Contributor
Add a standard .NET toolbar to your form and create buttons for the tools you want.  Inside the button click events, get references to the tools you want (via IDocument.CommandBars.Find) and set them to be the current tool (via IApplication.CurrentTool).


Thanks Neil, for your reply.
I did what you said. The code is following:

        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            UID pUID = new UIDClass();
            pUID.Value = "esriArcMapUI.ZoomInTool";    // Error: Value does not fall within the expected range
            ESRI.ArcGIS.Framework.ICommandItem commandItem = ArcMap.Application.Document.CommandBars.Find(pUID, false, false);

            if (commandItem != null)
            {
                ArcMap.Application.CurrentTool = commandItem;
            }
       }


I have attache a screenshot of error.
What may be reason of this error?
Reply
0 Kudos
Highlighted
Regular Contributor III
Try using the actual GUID for the tool instead of the ProgId. {AD1891E4-7C79-11D0-8D7C-0080C7A4557D}
I've run into problems using the ProgId.
Reply
0 Kudos
Highlighted
Occasional Contributor
Try using the actual GUID for the tool instead of the ProgId. {AD1891E4-7C79-11D0-8D7C-0080C7A4557D}
I've run into problems using the ProgId.


Thanks Neil.
It worked fine.
But, how can I find ProgId for "SelectFeaturesTool" and other several tools. Is there a way to find this or from help?
Reply
0 Kudos
Highlighted
Occasional Contributor
I found about ProgID from this link: http://resources.esri.com/help/9.3/arcgisdesktop/com/shared/desktop/reference/ArcMapIds.htm

My problem solved.
Thanks Neil for your help.
Reply
0 Kudos
Highlighted
Regular Contributor III
Reply
0 Kudos