Form modal !!!

Hello, I am beginner in Navision Axapta. How to create a form modal? [:)] Thank, Carmelo.

hi Carmelo I will request you to go through the Axapta developer guide. And read the creating forms chapter. A short description from Axapta developer guide Display a message box When you want to display a brief, modal message, use the application class Box. The Box methods correspond to the different values of the system enum dialogBoxType: Dialog type Enum value/method names When to use the Box methods Information dialog infoBox The user should be informed of something, and must click OK. Warning dialog warnBox The user should be warned of something, and must click OK. Yes/No dialog yesNoBox The user is given a choice where he must click Yes or No. Stop dialog stopBox The application has stopped, possibly because some error happened, or something serious is going to happen, and the user must click OK. Yes/No/Cancel dialog yesNoCancelBox The user is given a choice where he must click Yes, No, or Cancel. Ok/Cancel dialog okCancelBox The user is given a choice where he must click OK or Cancel. When you implement Box:: you should Choose the box method appropriate to the situation. Use the return value (of type DialogButton) for situations that require the user to make a choice (the Yes/No dialog, the Yes/No/Cancel dialog, and the Ok/Cancel dialog) Define a default button (of type DialogButton) when you use more than one button (for the dialog types mentioned above) Write a text that the user can understand. Define a suitable caption. Write a suitable help text. Examples Box::warning("@SYS53167’, “@SYS18245’) (box::yesno(strfmt(”@SYS24509", ledgerJournalTrans.paymentReference), DialogButton::Yes, “@SYS24283”, “@SYS29058”) == DialogButton::Yes) Note The application class Box makes use of the system class DialogBox. However, you should not call DialogBox directly, but always use Box as an indirection regards Vaibhav

for any form (not dialogue) possible do so… but this it is necessary to use only as required if - it is impossible use “Always on Top”))) (the side effect - when calling from modal form other modal) X++ code:--------------------------------------------------------------------------------> public void run() { super(); this.setFormModal(this.hWnd(), true); } //--------------------------------------------------------------------- public void close() { super(); this.setFormModal(this.hWnd(), false); } //--------------------------------------------------------------------- void setFormModal(int _thisHWND, boolean _bModal) { DLL _winApiDLL; DLLFunction _EnabledWindow; DLLFunction _getTop; DLLFunction _getNext; DLLFunction _getParent; void local_enableWHND(int _lHWND) { int lnextWnd; lnextWnd = _getTop.call(_getParent.call(_lHWND)); while (lnextWnd) { if (lnextWnd != _lHWND) _enabledWindow.call(lnextWnd, (!_bModal)); lnextWnd = _getNext.call(lnextWnd, 2); } } ; _winApiDLL = new DLL(‘user32’); _getNext = new DLLFunction(_winApiDLL, “GetWindow”); _EnabledWindow = new DLLFunction(_winApiDLL, “EnableWindow”); _getTop = new DLLFunction(_winApiDLL, “GetTopWindow”); _getParent = new DLLFunction(_winApiDLL, “GetParent”); _getParent.returns(ExtTypes:: DWORD); _getParent.arg(ExtTypes:: DWORD); _EnabledWindow.returns(ExtTypes:: DWORD); _EnabledWindow.arg(ExtTypes:: DWORD, ExtTypes:: DWORD); _getTop.returns(ExtTypes:: DWORD); _getTop.arg(ExtTypes:: DWORD); _getNext.returns(ExtTypes:: DWORD); _getNext.arg(ExtTypes:: DWORD, ExtTypes:: DWORD); local_enableWHND(_thisHWND); local_enableWHND(_getParent.call(_thisHWND)); } X++ code:--------------------------------------------------------------------------------< accustomed modality is absent in Axapta ) there is way more simply - if Modal form only to caused to form

I’m using this code in AX3.0, but when updating the code to AX2009, it fails to work.

Does anyone know how to update this code, so it works in 2009??

Thx,

Koen

We started using the WinAPI technique in 3.0 but have found that it makes other forms not accessible (namely Infologs on errors from the modal form). I am now looking into revamping these forms to remove the WinAPI modal calls and found that the FormRun class has a wait() method that tales a boolean parameter to set the modal functionality. It seems that this works better in that it will allow forms called from it to be usable. This does require that the form be called from from code as far as I can tell.

Check this post for examples of prompt dialogs:

http://xplusplus.info/index.php/how-to-prompt-a-dialog-box-or-a-modal-window/