Skip to main content
Inspiring
Jan 8, 2026 7:48 AM UTC
Answered

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

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?

 

Dirk BeckerCorrect answer
Legend
Jan 9, 2026 8:51 PM UTC

Watch IID_IRENDERINGOBJECT.

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

 

2 replies

Dirk BeckerCorrect answer
Legend
Jan 9, 2026 8:51 PM UTC

Watch IID_IRENDERINGOBJECT.

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

 

Translate
lyj2871Author
Inspiring
Jan 10, 2026 4:42 AM UTC

Thank you very much.

Translate