Search code examples
formslockingaxaptadynamics-ax-2012x++

How to lock Form during lunch a class?


I have a simple Form MyCustomForm, in a Form's Button in Clicked method I call a Class (method run), so I want to lock (or block) this form during run execution.

My code is look like this :

void clicked()
{// in Button clicked in **MyCustomForm**
     MyClass myClass;
     super();
     myClass = new MyClass();

     // here I want to freeze my FORM 
     myClass.run();
    // here I want to unlock my Form
}

I need this because when class (MyClass) is running can display Dialog etc, but I don't want to touc/click and other on MyCustomForm

If I use :

element.wait(); // not work well - block all
myClass.run();

Thanks, enjoy.


Solution

  • If your class displays dialog you can make this dialog modal using the following line of code dialog.parmIsModal(true). Or formRun.wait(true) for forms.