Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Event OnCloseView

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
marcelo.zatteraBGGNH
188 Views, 2 Replies

Event OnCloseView

Hi!

 

I need to test the OnCloseView event in my Inventor add-in, where if a condition is true, that the OnCloseView event is canceled, that is, that the document remains open.

 

For example:

 

private void AppEvents_OnCloseView(Inventor.View ViewObject, EventTimingEnum BeforeOrAfter, NameValueMap Context, out HandlingCodeEnum HandlingCode)
{
     HandlingCode = HandlingCodeEnum.kEventHandled;

     if (true)
     {
         //keep document open
     }
}

 

Could anybody help me?

 

Thanks

2 REPLIES 2
Message 3 of 3

Hi!

 

I'm trying another way, but I'm still having the same problem, I can't cancel closing the document.

 

private void AppEvents_OnCloseDocument(_Document DocumentObject, string FullDocumentName, EventTimingEnum BeforeOrAfter, NameValueMap Context, out HandlingCodeEnum HandlingCode)
{
     HandlingCode = HandlingCodeEnum.kEventCanceled;

      if (BeforeOrAfter == EventTimingEnum.kBefore)
      {
          bool shouldCancelClose = CheckSomeCondition(DocumentObject);

           if (shouldCancelClose)
           {
                HandlingCode = HandlingCodeEnum.kEventCanceled;
           }
       }
}

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

Post to forums  

Autodesk Design & Make Report