Skip to main content
Legend
November 24, 2025
Question

C++ SDK: I want to receive notifications when a dialog is opened.

  • November 24, 2025
  • 3 replies
  • 594 views

I want to receive notifications when a dialog box opens. Is that possible?

3 replies

Legend
November 26, 2025

So you're still looking at shortcuts and related UI. This summer I also spent some (too much) time on them, as an exercise in UXP, initially copied the existing dialog to validate my script methods. Below is the intermediate result with a few additions. One time sink was to convert between UXP key events and virtual keys, also capture all of them. Better done in C++, UXP is far from complete. I filed several related improvement suggestions.

 

On the other hand have a look at Bridge or Premiere and see their reworked KBSC Editor, I guess that at some point in time this will also trickle down to InDesign rendering outside efforts obsolete, so I shifted back my focus to other projects.

 

Legend
November 26, 2025

When you prefer observers, attach to kAppBoss kWindowAddedMessage IID_IWINDOWLIST.

The void* is a kMovableModalWindowBoss, next level is kKBSCEditorDlgBoss .

On the way out that's kRemoveWindowMessage

 

Legend
November 26, 2025

Thank you for the valuable information.
I was trying to see if it could be done using idleTask.
I was modifying the RunTask method in PnlTrvIdleTask.cpp of the SDK's PanelTreeView and testing it.

if( appFlags == IIdleTaskMgr::kModalDialogUp)
{
	do
	{
		InterfacePtr<IApplication> iApplication(::GetExecutionContextSession()->QueryApplication());
		if (iApplication == nil) break;

		InterfacePtr<IDialogMgr> iDialogMgr(iApplication, ::UseDefaultIID());
		if (iDialogMgr == nil) break;

		IWindow* iWindow = iDialogMgr->GetFrontmostDialogWindow();
		if (iWindow == nil) break;

		InterfacePtr<IDialog> iDialog(iWindow, ::UseDefaultIID());
		if (iDialog == nil) break;

		iDialog->PressDefaultButton();

	} while (false);
}

I succeeded in closing the dialog after it opened.

 

Regarding the kAppBoss kWindowAddedMessage IID_IWINDOWLIST you suggested,
I'll give it a try. Thank you for your kindness.

Legend
November 26, 2025

When you really intend to suppress or replace the dialog, it might be sufficient to remove the action using an action filter. On the other hand, that's also a drastic step towards users so think twice.

 

@Manan Joshi also mentioned the SuppressedUI plugin template, it might also do what you want. I never liked the idea so I don't know its details, e.g. if you borrow some code from there would you be able to coexist with other plugins that do the same?

Community Expert
November 25, 2025

Hi @琥珀 猫太郎,

If it is your own dialog then DialogController could help which you must have figured out. If it is some other plugin's dialog look for a possibility of adding your observer to it. Another option not tried by me could be to look into suppressedUI

-Manan

-Manan
Legend
November 25, 2025

I'm hoping to catch when the shortcut dialog opens.
I have absolutely no idea what to add the Observer to.

Legend
November 26, 2025

It usually opens when the action is invoked …

There is some weird way so action components can watch other actions, even without overriding them.

Read the headers on those special fields and constants in action definition resources.

Scripted action events should work the same way, or they may be easier if you work both sides.