If I add a detail tab for items, it will show in both Item master and the Item Record window (right click and select Edit), is there any attribute in the context or sth. so that I can realize whether I am in the Item Record window (where the item is already editable) or not (where I must call EditItems to get it editable)?
Solved! Go to Solution.
Solved by jan.liska. Go to Solution.
Solved by Redmond.D. Go to Solution.
Unfortunately there is no navigation context for tab views. It's on our list to fix.
If you are in Vault 2012, I have a workaround for you. In your OnStartup function, hook to the application.CommandBegin and application.CommandEnd events. When the Item edit window opens, you will get an event for the "Item.Edit" command. When the window closes, you get the end event for the "Item.Edit" command. So the item is in an editable state between these two events.
Here is what the C# code would look like....
----------------------------------------------------------------------------
private bool m_isItemEditable = false;
public void OnStartup(IApplication application)
{
application.CommandBegin += new EventHandler<CommandBeginEventArgs>(application_CommandBegin);
application.CommandEnd += new EventHandler<CommandEndEventArgs>(application_CommandEnd);
return;
}
void application_CommandBegin(object sender, CommandBeginEventArgs e)
{
if (e.CommandId == "Item.Edit")
m_isItemEditable = true;
}
void application_CommandEnd(object sender, CommandEndEventArgs e)
{
if (e.CommandId == "Item.Edit")
m_isItemEditable = false;
}
Alternate option is to check type name of parent form:
if (ParentForm != null)
{
Type formType = ParentForm.GetType();
if (formType.Name.Equals("EditCreateForm", StringComparison.InvariantCulture))
{
...
}
}