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

How to create the most primitive modal dialog?

New Here ,
Jan 21, 2009 Jan 21, 2009

Copy link to clipboard

Copied

I try:
1. define dialoge resource:

16000 DIALOGEX 12, 9, 161, 67
STYLE WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX |
WS_MAXIMIZEBOX
CAPTION "Align"
FONT 8, "MS Sans Serif"
{
}

2. I try to create dialog object:

//create callback functions
ADMErr ADMAPI PluginDlgInitProc(ADMDialogRef dialog)
{
sADMDialog10->DisplayAsModal(dialog);
return kNoErr;
}
ADMErr ADMAPI PluginDlgInitProc2(ADMDialogRef dialog)
{
return kNoErr;
}
//get plugin reference
ADMPluginRef plugin_ref = this->GetPluginRef();

//create object
dialog = sADMDialog->Create(plugin_ref , "modal dialog", 16000, kADMModalDialogStyle , PluginDlgInitProc, PluginDlgInitProc2, 0 );

All is compiled without errors and loaded by the illustrator.
After I start this code in illustrator occurs nothing.
If I try to start a code in debugger that is carried out of nothing after sADMDialog-> Create.
"try" & "catch" also does not allow to see any error.

What do I do not so?
What it is necessary to me for dialogue creation?
TOPICS
SDK

Views

1.1K

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
Guide ,
Jan 21, 2009 Jan 21, 2009

Copy link to clipboard

Copied

You've run into one of my pet peeves I've afraid -- the ADM doesn't support DIALOGEX.

I believe you'll find that when 'nothing happens', that AI seems to be hung; if you hit escape though, I believe it will act like you just hit cancel on your missing dialog 🙂 At least, that's how it used to be.

Fortunately the fix is fairly easy. Change DIALOGEX to DIALOG and remove the FONT line (entirely). Save, recompile and your dialog should show up. The only bad thing here is that EVERY TIME you use the Studio dialog editor, it's going to save it as DIALOGEX. I actually downloaded a regex utility and added a build step to do the DIALOGEX -> DIALOG changes. It's annoying, but it saves you big hassles, especially if you're tweaking dialogs a lot in Studio.

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 ,
Jan 21, 2009 Jan 21, 2009

Copy link to clipboard

Copied

I apologise for the bad knowledge of English.

I think that the problem consists not only in it.
In my case illustrator not be hung it simply continues to work.
I have replaced DIALOGEX on DIALOG and have removed a line of a font but result of running of this code is same.

16000 DIALOG 12, 9, 161, 67
STYLE WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX |
WS_MAXIMIZEBOX
CAPTION "Align"
{
}

I have tried to insert a dialogue code into a file of resources in Тutorial example plugin and replace id as a result I have seen the working dialogue in illustrator.

But in my plug-in based on MenuPlay exsample the object of dialogue is not create by illustrator.

I think that had not made what that of preliminary actions necessary for work with ADM.

From documentation I understood that (all that it is necessary to create dialogue):
1.Acquire Suites ADMDialogSuite10 and ADMItemSuite9.
2. Create dialog resource and replace DIALOGEX -> DIALOG. delete font line
3. in code use Create or Modal function.
4. show dialoge with DisplayAsModal or Show.

I think that on the third step I transfer not correct attributes of function Create.

I have begun with MenuPlay example and had created function as a method of class MenuPlayPlugin

ASErr MenuPlayPlugin:: RegDialog (AIMenuMessage* message)

in this function I create dialogue.

I Had added the menu and from it call RegDialog func and transfer "AIMenuMessage* message" as attribute.
That is message-> d.self sending as SPPluginRef in Create function.

Probably message-> d.self is not correct argument?
Whether more steps for dialogue creation are necessary still ?

Very 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
Guide ,
Jan 21, 2009 Jan 21, 2009

Copy link to clipboard

Copied

Well, the dialog resource sounds correct now. Fortunately, unless you specifically load & alter that dialog resource in Studio, studio will leave it alone.

As for the other problem, what you're doing sounds correct. 'message->d.self' should be the same for any message, and should be the correct SPPluginRef -- so that shouldn't be the problem.

One thing to try just to maybe narrow things down -- you usually indicate a 'on create' callback function when you create the ADM dialog. The first thing to do is see if that function gets called. If it's not getting called, the dialog isn't even getting created. If it is, you'd at least know it got that far.

Either way, maybe post the code you wrote to create the dialog and display it. Maybe I'll spot something.

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 ,
Jan 21, 2009 Jan 21, 2009

Copy link to clipboard

Copied

All has turned out) I simply have not correctly requested ADMDialogSuite10

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
Guide ,
Jan 21, 2009 Jan 21, 2009

Copy link to clipboard

Copied

LATEST
Glad to hear it's under control! Let me know if you have any other problems. Good luck!

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