1

I have a UI tool button, I would like to get and use the existing function (select elements tool) in Arcmap when I activate this button, does anybody know that how to call the existing function using Vb arcobjects ??

2 Answers 2

2

You can use the ArcMap Commands, eg.

  Dim pUID As New UID
  Dim pCmdItem As ICommandItem
  ' Use the GUID of the Save command
  pUID.Value = "{161496AD-AC99-11D2-87F8-0000F8751720}"
  ' or you can use the ProgID
  ' pUID.Value = "esriArcMapUI.EditSelectAllCommand"
  pUID.SubType = 3
  Set pCmdItem = Application.Document.CommandBars.Find(pUID)
  pCmdItem.Execute

Or, check out this forum post to grab elements on mouse up event.

http://forums.esri.com/Thread.asp?c=93&f=993&t=158293

0
0

Not sure if I understand you correctly, but would it not make sense to explicitly GET the tool you want...just in case the user has not selected it? It's OK to set it if it's already set.

Dim pCmdBar As ICommandBar
Dim pCmdItem As ICommandItem
Dim pUID As New UID

Set pCmdItem = Document.Parent.Document.CommandBars.Find(ArcID.PageLayout_SelectTool)
Set ThisDocument.Parent.CurrentTool = pCmdItem

Note that ArcID.PageLayout_SelectTool is for ArcGIS 10, in 9.3 it was Select_Elements I think.

Hope this helped.

1
  • thanks for your answering ! I solved the problem ! thanks !!!
    – Emma
    Commented Feb 27, 2012 at 18:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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