Hello Everyone,
I am facing small issue in arcobject programming, please help me out from this.
I am using below function to activate editor toolbar
internal void OpenCommandItem(string strUID)
{
UID pAttributeEditorUID = new UID();
pAttributeEditorUID.Value = strUID;
IMxDocument pmxDoc = ArcMap.Document;
IDocument pDoc = (IDocument)pmxDoc;
ICommandBars pCmdBars = pDoc.CommandBars;
ICommandItem pCommItem = pCmdBars.Find(pAttributeEditorUID, false, false);
pCommItem.Execute();
pCommItem.Refresh();
}
parameter value is : esriArcMapUI.EditingToolbarCommand
Now, When i am closing the arcmap without closing editor toolbar and next time i use same function to activate it , actually it is hiding toolbar that time. It is only working in scenario when i am closing editor toolbar manually before closing arcmap. Please suggest .
Regards
Solved! Go to Solution.
i can able to make out this using
UID uid = new UIDClass();
uid.Value = "esriEditor.EditingToolbarNew";
ICommandBar pCI = (ICommandBar)ArcMap.Application.Document.CommandBars.Find(uid, false, false);
UID id = new UIDClass();
id.Value = "esriArcMapUI.EditingToolbarCommand";
ICommandItem ec = (ICommandItem)ArcMap.Application.Document.CommandBars.Find(id, false, false);
bool visibility = pCI.IsVisible();
if (!visibility)
ec.Execute();
still if there is any better way please let me know thanks
Hi
Try ((ICommandBar)pCommItem).IsVisible to show if it is already visible
Thanks for quick reply but i am getting following error
Cannot cast 'pCommItem' (which has an actual type of 'System.__ComObject') to 'ESRI.ArcGIS.Framework.ICommandBar'
Regards
Saurabh
You are getting the command to turn on the toolbar and not the toolbar itself.
You can try something like this
ICommand cmd = pCommItem.Command
Then check cmd.Checked
Did not tried it but should work
Hi Mody,
There is nothing like pCommItem.Command.
Regards
ICommandItem is your var of type ICommandItem.
This interface have Command property, try get_Command.
i can able to make out this using
UID uid = new UIDClass();
uid.Value = "esriEditor.EditingToolbarNew";
ICommandBar pCI = (ICommandBar)ArcMap.Application.Document.CommandBars.Find(uid, false, false);
UID id = new UIDClass();
id.Value = "esriArcMapUI.EditingToolbarCommand";
ICommandItem ec = (ICommandItem)ArcMap.Application.Document.CommandBars.Find(id, false, false);
bool visibility = pCI.IsVisible();
if (!visibility)
ec.Execute();
still if there is any better way please let me know thanks