Change Caption of Base Command

2279
10
04-13-2011 09:35 AM
deleted-user-ATjHIWsdQYmT
Occasional Contributor III
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
0 Kudos
10 Replies
SherryVotava
New Contributor II
I'm experiencing the same with my command under 10.  Did you come up with a solution?
0 Kudos
deleted-user-ATjHIWsdQYmT
Occasional Contributor III
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?
0 Kudos
SherryVotava
New Contributor II
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.
0 Kudos
deleted-user-ATjHIWsdQYmT
Occasional Contributor III
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.
0 Kudos
JohnHauck
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.
0 Kudos
deleted-user-ATjHIWsdQYmT
Occasional Contributor III
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?
0 Kudos
deleted-user-ATjHIWsdQYmT
Occasional Contributor III
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?
0 Kudos
ChrisFox3
Occasional Contributor III
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.
0 Kudos
deleted-user-ATjHIWsdQYmT
Occasional Contributor III
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?
0 Kudos