Skip to main content
Inspiring
January 8, 2026
Answered

How can I capture change events for the contents of the Swatches panel?

  • January 8, 2026
  • 1 reply
  • 153 views

When a swatch is added to or removed from the Swatches panel in the document workspace, I need to capture this event.

Which protocol should I observe?

In my observer implementation, I attached like this:

InterfacePtr<ISubject> wsSubject(workspaceRef, IID_ISUBJECT);
wsSubject->AttachObserver(
    ISubject::kBothAttachments,
    this,
    IID_ISWATCHLIST,
    IID_SELECTION_CHANGE_IOBSERVER
);

 

 However, in my Update() function:

if (protocol == IID_ISWATCHLIST)
{
    // never reached
}

 

I cannot receive any notifications at all.

What is the correct way to observe swatch creation and deletion events in the workspace?

 

Correct answer Dirk Becker

Watch IID_IRENDERINGOBJECT.

Beware, it is used for multiple purposes, the message tells the used command which is also in the void*.

 

1 reply

Dirk BeckerCorrect answer
Legend
January 9, 2026

Watch IID_IRENDERINGOBJECT.

Beware, it is used for multiple purposes, the message tells the used command which is also in the void*.

 

lyj2871Author
Inspiring
January 10, 2026

Thank you very much.