Skip to main content
Inspiring
April 24, 2009
Question

CS3: Observe selection of a page item without GUI

  • April 24, 2009
  • 1 reply
  • 844 views

Hi

My plugin has no dialog and no panel. I like to observe the selection of the page items in my document. If the user select a page item (layout tool OR text tool) I want to be notified in my handler (HandleSelectionUpdate). This works fine if I have a dialog or panel (ActiveSelectionObserver) but I havn't one.

The problem is that I have no GUI and don't find the solution how I have to implement the observer in that case.

I read the discussions in this forum about this problem, but I can't find the solution.

Can anybody help me?

The best is if you have a shor code snippet.

Thanks a lot and I wish you a nice weekend

Hans

This topic has been closed for replies.

1 reply

Inspiring
April 24, 2009

If the observer is on a non-widget boss, you have to call your AutoAttach/Detach() yourself.

E.g. from a StartupShutdown service.

Dirk

hstoesselAuthor
Inspiring
April 24, 2009

Hi Dirk

Thanks for the fast answer.

I try to do that. But how have I to define the observer in the fr file? Have I to add it to the DocBoss? To the application? Or what have I to do?

I need the object in the startup to call the AutoAttach method and I don't know how to do that.

Thanks

Hans

Inspiring
April 24, 2009

See IStartupShutdownService.h

You can add it to the same service boss, or any other boss if you can find that boss from your startup code.

If you use the service boss, you'll have these interfaces:

IID_IK2SERVICEPROVIDER,kLazyStartupShutdownProviderImpl,

IID_IAPPSTARTUPSHUTDOWN,kYourStartupShutdowImpl,

IID_IOBSERVER,kYourObserverImpl,

If you put it onto an InDesign boss (e.g. gSession / kSessionBoss ),
you have to use an AddIn clause in the .fr, see the plenty examples in the SDK.
In that case, you must also use a private IID instead of IID_IOBSERVER.
Dirk