Change Caption of Base Command

1813
10
04-13-2011 09:35 AM
Highlighted
Regular Contributor
I have a tool that inherits BaseCommand.  It's set as a Toggle button to be toggled on when editing and off when not.  When toggled on the caption should read "Stop Editing" and when Off it should read "Start Editing".  The code below worked fine in 9.3.1 but for some reason the caption no longer changes. 

Any ideas?

 Public Overrides Sub OnClick()
        'TODO: Add StartStopEditing.OnClick implementation

        Dim pID As New UID
        Dim pfLayer As IFeatureLayer = Nothing
        Dim pDataSet As IDataset = Nothing
        Dim pMxDoc As IMxDocument = Nothing

        'Start/Stop Editing Sign workspace
        Try
            pID.Value = "esriEditor.Editor"
            _pEditor = m_application.FindExtensionByCLSID(pID)
            pMxDoc = CType(m_application.Document, IMxDocument)
            pfLayer = pMxDoc.FocusMap.Layer(GetIndexNumberOfLayerName(pMxDoc.ActiveView, sLayerName))
            pDataSet = pfLayer.FeatureClass
            If _pEditor.EditState = ESRI.ArcGIS.Editor.esriEditState.esriStateNotEditing Then
                _pEditor.StartEditing(pDataSet.Workspace)
                MyBase.m_caption = "Stop Editing"
                MyBase.m_checked = True
            ElseIf _pEditor.EditState = ESRI.ArcGIS.Editor.esriEditState.esriStateEditing Then
                MyBase.m_caption = "Start Editing"
                MyBase.m_checked = False
                _pEditor.StopEditing(True)
            End If

        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
    End Sub
Reply
0 Kudos
10 Replies
Highlighted
New Contributor
I'm experiencing the same with my command under 10.  Did you come up with a solution?
Reply
0 Kudos
Highlighted
Regular Contributor
I'm experiencing the same with my command under 10.  Did you come up with a solution?


Nope, I have yet to come to a solution.  Have you tried Tech Support?
Reply
0 Kudos
Highlighted
New Contributor
Nope, I have yet to come to a solution.  Have you tried Tech Support?


No, I have not contacted them.  I need to talk to my end users first and see if they even care.
Reply
0 Kudos
Highlighted
Regular Contributor
No, I have not contacted them.  I need to talk to my end users first and see if they even care.


Unfortunately I need it to change.  If I have time I'll call Support.  Let me know if you get a solution beforehand.
Reply
0 Kudos
Highlighted
Occasional Contributor II
This is logged as NIM059312. If you have support please contact ESRI technical support and have your customer information associated with the NIM.
Reply
0 Kudos
Highlighted
Regular Contributor
This is logged as NIM059312. If you have support please contact ESRI technical support and have your customer information associated with the NIM.


Contacted Support.  They created a new incident and referenced the NIM.  What should my expectations be of this being fixed relatively soon?
Reply
0 Kudos
Highlighted
Regular Contributor
I just did a quick lookup to see the status of this bug.  When i search customers.esri.com there is no update.  BUT.. if I just search for the NIM under support.esri.com I see it has been "DECLINED".  Really!?  Since when is it appropriate to decline fixing something that used to work to begin with?
Reply
0 Kudos
Highlighted
Regular Contributor II
Hi Andrew,

Unfortunately this is a known-limit at 10.0 with the new command bars. At 10.1 you will be able to use CommandItem.Caption to accomplish this workflow.
Reply
0 Kudos
Highlighted
Regular Contributor
I haven't tried yet but, will CommandItem.Caption work at 10.0?  If not, what is (or is there)a workaround?

UPDATE:  I tried... It didn't work.  So what do us 10.0 users do?
Reply
0 Kudos