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 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 ??

share|improve this question
add comment

2 Answers

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

share|improve this answer
    
Thanks a lot for the link! it helps a lot !!! –  Emma Feb 27 '12 at 18:14
add comment

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.

share|improve this answer
    
thanks for your answering ! I solved the problem ! thanks !!! –  Emma Feb 27 '12 at 18:15
add comment

Your Answer

 
discard

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

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