September 06, 2013

Simple Dialog Box in Axapta 2012

Simple Dialog Box in Axapta 2012






Hi Folks,

The following example displays the dialog box and prints the value entered to the screen.

Code:
static void theAxapta_DialogBox(Args _args)
{
dialog              dialog;
dialogGroup    dialogGroup;
dialogField      dialogField;
;
dialog              = new Dialog("Simple Dialog");
dialogGroup    = dialog.addGroup("Customer");
dialogField      = dialog.addField(extendedTypeStr(custAccount));
if (dialog.run())
{
print dialogField.value();
pause;
}
}

Output:
















Note:

    1.   The dialog.run() method returns true if OK is clicked, and false if Cancel is     clicked.
    2.   Dialog Group is used to group dialog fields which are logically same.

-Harry

8 comments:

  1. Thanks alot Agarwal..Nice article everything is clear in your post for Dialog box.I hope this is very useful to all AX developers.

    ReplyDelete
    Replies
    1. Hi Suresh,

      Its good to hear that my post helps you. Keep in touch for latest update and also i need you guys feenback on the same.

      Delete
  2. Can you please explain the syntax?

    ReplyDelete
  3. i understood the concept dialog box
    thanks for your post

    ReplyDelete
  4. Hi!

    I'm absolutely new to ax, and the major problem with such examples is lack of the seemingly obvious steps. Like for instance - how to call this method and what arguments to pass? (Args _args)

    ReplyDelete
    Replies
    1. Hi Lauris,

      Here i posted this code under a job thats why used Args to execute this identically. If you are putting code in any existing object you dont need to use Args. You can try to copy paste this code on a click event of new button (add a new button on any form).

      dialog dialog;
      dialogGroup dialogGroup;
      dialogField dialogField;
      ;
      dialog = new Dialog("Simple Dialog");
      dialogGroup = dialog.addGroup("Customer");
      dialogField = dialog.addField(extendedTypeStr(custAccount));
      dialog.run();
      if(dialog.closeok())
      {
      print dialogField.value();
      pause;
      }

      Delete
  5. Hi i need Based on first dialog field the second dialog field should be filter
    will you please help me

    ReplyDelete

Thanks