• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Indesign Extension from Plugin Modal dialog

Contributor ,
Mar 14, 2021 Mar 14, 2021

Copy link to clipboard

Copied

Hi

I have a InDesign C++ plugin that is has a modal dialog and it's corresponding observer. I am launching a extension on the click of a button on this modal dialog. Here's a rough pseudocode

 

CMyDlgObserver::Update(const ClassID& pChange, ISubject* pSubject, const PMIID& pProtocol, void* pChangedBy)
{
// Call the base class Update function so that default behavior will still occur (OK and Cancel buttons, etc.).
CDialogObserver::Update(pChange, pSubject, pProtocol, pChangedBy);

do
{
InterfacePtr<IControlView> controlView(pSubject, UseDefaultIID());

CHECK_BREAK(controlView);

// Get the widget ID from the view.
WidgetID theSelectedWidget = controlView->GetWidgetID();

if(theSelectedWidget == kMyButtonWidgetID && pProtocol == IID_IBOOLEANCONTROLDATA && pChange == kTrueStateMessage)
{
LaunchExtension(controlView);
}
} while (kFalse);

}

 

My Extension has the following fragment of manifest (

<HostList>
<Host Name="IDSN" Version="15" />
</HostList>
            <UI>
               <Type>ModalDialog</Type>
               <Menu>MyExtension</Menu>
               <Geometry>
                      <Size>
                        <Height>107</Height>
                        <Width>290</Width>
                     </Size>
                     <MaxSize>
                        <Height>700</Height>
                        <Width>1280</Width>
                     </MaxSize>
                     <MinSize>
                        <Height>107</Height>
                        <Width>290</Width>
                     </MinSize>
               </Geometry>
            </UI>

 

I have the folowing observations and questions:

1. Does Indesign support Modal Extensions?

2. When the call LaunchExtension is done, the extension window launches correctly, on top the plugin modal dialog. However, after closing the extension window, I notice that my original modal dialog (on who's button click the extension is launched) effectively becomes non modal (I can click the InDesign Menus though most of them are non functional). This creates possiblity to execute some otherwise impossible use cases had the plugin dialog stayed modal. One such example is right clicking the InDesign instance on the windows status bar and click on "Close Window" as shown)

asaxena_0-1615782116782.png

This shutdown event is effectively blocked while a modal dialog is shown, but now since the plugin dialog is open, shutdown event seems to get triggerred. There are several such undesirable behaviors that become possible just because the original plugin modal dialog effectively became non-modal.

 

Continuing, now, when I dismiss the plugin dialog, when I click on any menu item, InDesign Debug version shows the following dialog

 

asaxena_1-1615782356309.png

I suspect this is due to some interaction of the extension and the plugin. I need some help with my situation and to understand what is happening behind these observed behaviors and what is the right way to integrate the modal plugin dialog and the extension (in case it already isn't)

 

Thanks,

TOPICS
How to , Scripting , SDK

Views

367

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 16, 2021 Mar 16, 2021

Copy link to clipboard

Copied

Please let me know if I can provide more information for clarity.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 16, 2021 Mar 16, 2021

Copy link to clipboard

Copied

Hi,

 

Trying to understand the flow of your solution.

- c++ plugin shows modal dialog

- c++ plugin modal dialog's "OK" button clicked

- c++ plugin closes modal dialog AND opens extension modal dialog

 

This is where issues are, because there appears to be two modal dialogs?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 16, 2021 Mar 16, 2021

Copy link to clipboard

Copied

- C++ plugin shows modal dialog

- a button on the modal dialog is clicked (not OK button), which launches Extension Window (manifest defines it as Modal). So, therefore, a modal extension Window on top of Modal Plugin Window

- Close the modal extension window

 

All the problems in the OP are now observed.

Thanks,

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 16, 2021 Mar 16, 2021

Copy link to clipboard

Copied

LATEST

Hi,

 

This appears to be a Immovable object vs an irresistable force. As a modal dialog should take all the user input from the main window, how would two objects that are supposed to take the input supposed to work?

 

I would think you would have to close one before opening the other, so that there is only one modal object.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines