Problem - trying to 'Find' an Editor Extension

3188
15
Jump to solution
06-20-2012 12:36 PM
by Anonymous User
Not applicable
Original User: robit2

Hi,

I am new to the vb.net and ArcGIS development environment.  
I am trying to add some custom code to our ArcGIS application, through vb.net. 

There was an existing vb project that existed, for various custom code functionality, that was written previously by other people no longer in this group.

They had an IExtension interface.  I have just found it to be an Editor Extension class.

I have created a new IToolControl class, that implements a new drop-down ComboBox.  I have used the Tools->Customize->Commands tab, to add(drag) this new ToolControl to a custom toolbar.    This ComboBox is databound to an existing Oracle Table.  This process works.

I now need to use the selected value of the new combobox, and assign it to a different variable in the existing Editor Extension Class.

I am using the following code in my new IToolControl class.
However, the "m_pExt" value is always Null or Nothing.  

Am I missing something ?

Thanks so much.


  Public Sub OnCreate(ByVal hook As Object) Implements ESRI.ArcGIS.SystemUI.ICommand.OnCreate
      
        m_pApp = CType(hook, IApplication)

        m_pMxDoc = m_pApp.Document
     
  
      
        Dim u As UID = New UIDClass

        u.Value = "SaskTelVBNet.sln.Extension"

         m_pExt = m_pApp.FindExtensionByCLSID(u)

        m_AC_ComboBoxForm = New FrmControls

 
        m_AC_ComboBoxForm.ACCOUNT_CODE_TYPETableAdapter.Fill(m_AC_ComboBoxForm.DataSet7.ACCOUNT_CODE_TYPE)
    
      
    End Sub
0 Kudos
15 Replies
FengZhang2
Occasional Contributor
Please try the following for the editor extension reference:

            
            UID uid = new UIDClass();
            uid.Value = "esriEditor.Editor";
            IExtension Extension = ArcMap.Application.FindExtensionByCLSID(uid);
            IEditor m_editor = Extension as IEditor;

            IExtension Editor_Extension;
            UID attributeuID = new UIDClass();
            attributeuID.Value = "esriEditor.AttrWindow";
            Editor_Extension = m_editor.FindExtension(attributeuID) as IExtension;
0 Kudos
by Anonymous User
Not applicable
Original User: robit2

I think that worked ::

I am using vb.net ... so had to change the code somehwhat.


I tried to attach a snapshot through the attachments here.
0 Kudos
by Anonymous User
Not applicable
Original User: robit2

So, am I suppose to try to find my custom editor extension in a similar manner ?
0 Kudos
FengZhang2
Occasional Contributor
So, am I suppose to try to find my custom editor extension in a similar manner ?


Yes, I think so. Let us know if it still fails with your custom extension.
0 Kudos
by Anonymous User
Not applicable
Original User: robit2

It seems to have worked, yes ... with my custom Editor Extension.

So, the conclusion is that you do need to 'find' this editor extension, by 'finding' it from the Editor Object then, not the Application Object ?

Also, earlier I did actually try something similar to what you provided .. but it didn't work ........ but I had been calling Editor.FindExtensionByCLSID rather than just Editor.FindExtension   ?

So the method name is also different between Application Object and Editor Object ?

Anyways, thanks so much !
It appears to be working this way ... by getting reference to Editor Object and then using FindExtension.



======================================================================
Public Sub OnCreate(ByVal hook As Object) Implements ESRI.ArcGIS.SystemUI.ICommand.OnCreate
        m_pApp = CType(hook, IApplication)

        m_pMxDoc = m_pApp.Document
       
        

        Dim u As UID = New UID

        u.Value = "esriEditor.AttrWindow"



        Dim extension As IExtension
        Dim m_editor As IEditor
        Dim Editor_Extension As IExtension
        Dim attributeuID As New UIDClass()
        Dim myclassID As New UIDClass()

        u.Value = "esriEditor.Editor"

        extension = m_pApp.FindExtensionByCLSID(u)
        m_editor = TryCast(extension, IEditor)
        'm_editor = extension

        myclassID.Value = "SaskTelVBNet.sln.Extension"

        attributeuID.Value = "esriEditor.AttrWindow"
        Editor_Extension = m_editor.FindExtension(attributeuID)

        m_pExt = m_editor.FindExtension(myclassID)
0 Kudos
FengZhang2
Occasional Contributor
Yes, please look into the following help page for the FindExtension method:

-- IEditor.FindExtension Method --
http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#/FindExtension_Method/002...

"The FindExtension function provides a hook to the editor's extension objects. All of the extension objects are automatically created/instantiated when the Editor CoClass is created; use FindExtension to get a reference to them. "


It seems to have worked, yes ... with my custom Editor Extension.

So, the conclusion is that you do need to 'find' this editor extension, by 'finding' it from the Editor Object then, not the Application Object ?

Also, earlier I did actually try something similar to what you provided .. but it didn't work ........ but I had been calling Editor.FindExtensionByCLSID rather than just Editor.FindExtension   ?

So the method name is also different between Application Object and Editor Object ?

Anyways, thanks so much !
It appears to be working this way ... by getting reference to Editor Object and then using FindExtension.

0 Kudos