Community
Vault Customization
Share your knowledge, ask questions, and explore popular Vault API, Data Standard, and VBA topics related to programming, creating add-ins, or working with the Vault API.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How can I know if I am in the Item Record Window or not?

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
smilinger
403 Views, 3 Replies

How can I know if I am in the Item Record Window or not?

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)?

3 REPLIES 3
Message 2 of 4
Redmond.D
in reply to: smilinger

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;
}

 

 

 



Doug Redmond
Software Engineer
Autodesk, Inc.

Message 3 of 4
jan.liska
in reply to: Redmond.D

Alternate option is to check type name of parent form:

 

if (ParentForm != null)

{

    Type formType = ParentForm.GetType();

 

    if (formType.Name.Equals("EditCreateForm", StringComparison.InvariantCulture))

    {

        ...

    }

}



Jan Liska
Solution Architect
Autodesk, Inc.
Message 4 of 4
smilinger
in reply to: smilinger

Thank you for the reply! I will try these two methods.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report