simulate a double click to turn on Sketch Edit mode

1196
24
05-18-2010 06:23 AM
DanNguyen
New Contributor
Does anyone know how to simulate a double click in VB to turn on Sketch Edit mode programmatically?

Thanks in advance for your help.
0 Kudos
24 Replies
DanNguyen
New Contributor
Hi James,

I keep getting a run time error @ 'pEditor.StartOperation' in startEditing routine and I am not sure why.  Any idea?

I'm still trying to figure it out.

Dan.
0 Kudos
JamesCrandall
MVP Frequent Contributor
Hi James,

I keep getting a run time error @ 'pEditor.StartOperation' in startEditing routine and I am not sure why.  Any idea?

I'm still trying to figure it out.

Dan.


First I'd check to make sure you are setting the correct layer.  I had added this to the code, expecting you to change the name of the layer to your own:

If pGeoFeatureLayer.Name = "The Name of The Layer you Want to Edit Goes Here" Then <--this should changed to your layer


Next, I'd make certain that the map reference is correctly set (I think you said you are working in VBA environment, which will have differences from the code I posted).  Mainly you need to make sure pEditor is getting set:

Private Sub GetEditorReference()
        Dim pID As ESRI.ArcGIS.esriSystem.UID
        pID = New ESRI.ArcGIS.esriSystem.UID
        pID.Value = "esriCore.Editor"

        pEditor = m_pApp.FindExtensionByCLSID(pID)
 End Sub


If not, then you need to correctly set it (I cannot remember how to do it in VBA, something to do with the ThisDocument maybe).

Next, I'd step thru the code and see what else is not getting set.  If .StartOperation is failing then something has not properly been implemented.
0 Kudos
DanNguyen
New Contributor
yes, something is not set correctly.  I was stepping through the codes and that is where it stops.  I had this piece of code and it works this morning.  Anyway, I'll let you know.

Thanks!
0 Kudos
JamesCrandall
MVP Frequent Contributor
yes, something is not set correctly.  I was stepping through the codes and that is where it stops.  I had this piece of code and it works this morning.  Anyway, I'll let you know.

Thanks!


I simply don't remember how to get the application in VBA.  Here are some links, and do a search on ThisDocument:

http://forums.esri.com/thread.asp?t=214268&f=987&c=93
http://edndoc.esri.com/arcobjects/8.3/Samples/Editing/Edit%20Tools/Polygon%20Capturing%20Tool/clsPol...

I honestly can't remember, but something like:

  Dim pMXDoc As IMxDocument
  Dim pMap As IMap
  Dim pID As New UID

  ' QI for IMXDocument
  Set pMXDoc = ThisDocument
  
  'QI for the Editor
  pID.Value = "esriCore.Editor"

  Set pEditor = Application.FindExtensionByCLSID(pID)
0 Kudos
RayanthaRathnayake
New Contributor
Hi i also interested in this tool,
but let me know how to identify when click on the map
0 Kudos