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

Modal dialog box from resource file

New Here ,
Feb 11, 2021 Feb 11, 2021

Copy link to clipboard

Copied

How to create an application modal dialog box on a button click on Panel using Illustrator plugin development SDK ?

I show some API in AIUserSuite like OKCancelAlert, ErrorAlert, YesNoAlert, MessageAlert, MessageAlertEx, QuestionAlert.

However, I want to create my custom dialog from resource file, for that, How to get the main illustrator window's handle to pass in Win32 API 'DialogBox' to create the application modal dialogbox ?

TOPICS
Scripting , SDK

Views

502

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
Adobe
Guest
Feb 12, 2021 Feb 12, 2021

Copy link to clipboard

Copied

Moving thread to the Illustrator forum from Using the Community

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 ,
Feb 12, 2021 Feb 12, 2021

Copy link to clipboard

Copied

Hi Ged, can mods also add tags to posts? Here the SDK and Scripting tags would be useful if so.

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
Guest
Feb 12, 2021 Feb 12, 2021

Copy link to clipboard

Copied

Yep we can 🙂

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 ,
Feb 12, 2021 Feb 12, 2021

Copy link to clipboard

Copied

Nice, thank you!

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
New Here ,
May 08, 2021 May 08, 2021

Copy link to clipboard

Copied

Did you ever figure out a solution to this? I need to access the Adobe window handle in order to spawn a modal dialog. I also need to make this work for MacOS. 

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
New Here ,
May 10, 2021 May 10, 2021

Copy link to clipboard

Copied

I don't have perfect solution because the Panel window can be attached to other panel window too.

The workaround:

Find the most parent window handle for launching the dialog:

Used GetParent() function until I get the output parent handle as null or equal to GetDesktopWindow().

However, Sometime it is possible to go to Panel window from the dialog box.

Hence, the steps:

1. Disabled all the controls on Panel Window.

2. Launch the Dialogbox using MAKEINTRESOURCE, setting the parent as found by GetParent described above.

3. Once DialogBox returns, enable all the controls on Panel window

 

If you find any better solution then let me know.

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
Explorer ,
Sep 24, 2021 Sep 24, 2021

Copy link to clipboard

Copied

LATEST

Hi,

In your menu function use this:

You can defin HINSTANCE gHINSTANCE;

int nRetVal = DialogBoxParam(gHINSTANCE, MAKEINTRESOURCE(IDD_DIALOG1),NULL,DialogProc,0);

need to call dialgproc function, in dialog proc function use:

switch (uMsg)
{
case WM_INITDIALOG:
//CenterDialog(hDlg);
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDC_BUTTON1:

AfxMessageBox("button clicked");
case IDOK:
EndDialog(hDlg, IDOK);
break;
case IDCANCEL:
//SendMessage(hDlg, WM_CLOSE, 0, 0);
EndDialog(hDlg, IDCANCEL);
//return TRUE;
break;
}
break;

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