Search code examples
axaptax++dynamics-ax-2009

dialogPostRun method in RunBaseReport


I have a RunBaseReport which contains overrided dialog method where I'm adding couple of my controls. One of those controls is a combobox. Controls enabled() property should be changed when I'm modifying combobox.

So basically I need to know when the value of my dfReportType dialog field changes.

public Object dialog(Object dialog)
{
     DialogRunbase dialog = dialog;
     ;
     //adding my combobox
     dfReportType = dialog.addFieldValue(typeid(ReportType), ReportType:DefaultType);
     //adding some other controls here
     return dialog; 
}

According to many articles that I found I need to override dialogPostRun Method and do something like this:

public void dialogPostRun(DialogRunbase dialog)
{
    super(dialog);
    dialog.dialogForm().formRun().controlMethodOverload(true);
    dialog.dialogForm().formRun().controlMethodOverloadObject(this);
}

But unfortunately I don't have this method in RunBaseReport class. Which should be there according to msdn .

Are there any other workarounds?


Solution

  • Well, there is no dialogPostRun method in Report object that inherits RunBaseReport, but we have this method in Class that inherits RunBaseReport.

    So that was my mistake. I used report object instead of class.

    If you want to make custom dialog for the report but you also want to use all default controls you should:

    • Create class
    • Inherit RunBaseReport
    • Override dialog, getFromDialog etc.
    • Override lastValueElementName method

      public identifiername lastValueElementName()
      {
          //just put name of your report object
          return reportStr(YourReportName);
      }
      

    Don't forget to add main() method if you going to make call from menuItem.