web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

System Modal Dialog

(0) ShareShare
ReportReport
Posted on by

Hi Guys,

How to make an input dialog as system modal? i.e, without getting the input from the user the dialog box should not go to any other control including the parent form.

The following is the code i'm using. (this code makes the dialog box stand at the top but the user can still access other forms)

d = new Dialog("Enter On Hand");
fld = d.addField(TypeId(Qty),"Enter Stock");
d.dialogForm().form().design().left(_x,4);
d.dialogForm().form().design().top(_y,3);
d.formBuildDesign().windowType(FormWindowType::PopUp);
d.run(false);

Any inputs will be greatly appreciated.

Thanks 

Andrews

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    if validate result first?

    Declare a variable in form parent

    Qty valueQTY = 0;

    if(d.closedOk())      

       {

         valueQTY =fld.value();

       }

    when user make clik in the parent form, you validate

      if(valueQTY>0)

               info("Continue...");

          else

               info("The QTY is incorrect. Fill to continue..");

    not is modal but can function.

  • Verified answer
    Martin Dráb Profile Picture
    237,978 Most Valuable Professional on at

    What you need it calling form's wait() method with _modal parameter set to true.

    You can do it directly (replace d.run() with this):

    d.doRun();
    d.dialogForm().formRun().wait(true);

    Nevertheless I would rather add parm* method to Dialog class and use the value in Dialog.wait(), in the same way as how it's done in AX 2012.

  • PA-22040759-0 Profile Picture
    6,194 on at

    On a side note, this code will disable the AX wokspace, but not the caller form:

    ...

    WinAPI::enableWindow(infoLog.hWnd(), false);

    d.run();

    WinAPI::enableWindow(infoLog.hWnd(), true);

    ...

  • Suggested answer
    Community Member Profile Picture
    on at

    Thank you Martin. It's working.

  • Community Member Profile Picture
    on at

    Thanks Palle for your inputs. Martin's answer did the trick.

  • Community Member Profile Picture
    on at

    Thanks Roberto for your inputs. My inputs included "0" too. So i think this code will not work for me.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans