Skip navigation
Currently Being Moderated

How to get notified when InDesign Application hides (Mac)

Feb 2, 2012 9:54 AM

Hi!

 

I need to modify the behavior of a secondary process  I launch in my plugin when the InDesign app hides (from the dock or using the cmd+h key combination).

I was trying to add an observer and callback using the Notification Center (local) though I can't find a way to get the main or key window to do so.

 

Anyone has any pointers as how I can do this?

 

Thanks!

 
Replies
  • Currently Being Moderated
    Feb 2, 2012 12:48 PM   in reply to rfloresp

    I'm not sure what you mean with Notification Center (local).

    Sounds like an OSX specific thing.

     

    Instead, attach an InDesign IObserver to the kAppBoss, protocol IID_IAPPLICATION.

    You'll receive kApplicationSuspendMsg and kApplicationResumeMsg.

     

    Hth,

    Dirk

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 3, 2012 8:44 AM   in reply to rfloresp

    As Dirk rightly pointed out, you need to place an observer in the kAppBoss and observe on the IID_IAPPLICATION protocol.

     

    What you should do is just place an interface as an addin in the kAppBoss and give it an implementation (you don't need to create a observer boss class as you have done).

     

    In startup call the autoattach of your observer, for ex

      InterfacePtr<IApplication> app(gSession->QueryApplication());

     

      InterfacePtr<IObserver> iMyObserver(app, IID_IMYOBSERVER);

                        iMyObserver->AutoAttach();

     

    In the autoattach method of your implementation class, remember to pass your observers interface ID to the attachobsever method of the ISubject

    for ex

    AttachObserver(this, IID_IAPPLICATION, IID_IMYPOBSERVER);

     

    Then in the update method you will get properly notified of the suspend and resume of application

     

    This should fix your problem.

     

    Manan Joshi

     

    - Efficient InDesign Solutions -

    MetaDesign Solutions

    http://metadesignsolutions.com/services/indesign-development.php


     


     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points