RUNMODAL Function (Page)

Creates, opens, and closes a page that you specify. When a page is run modally, no input, such as a keyboard or mouse click, can occur except for objects on the modal page.

Syntax

  
[Action :=] Page.RUNMODAL  

Parameters

Page
Type: Variable

After you define this variable, you can run the following page functions:

  • SETTABLEVIEW

  • SETRECORD

  • GETRECORD

  • RUN

  • RUNMODAL

    Unlike the PAGE.RUN Function, the variable is not automatically cleared after this function runs.

    If the page that you specify does not exist, then a compile-time error occurs.

Property Value/Return Value

Type: Action

Specifies what action the user took on the page. The following table shows the possible return values for the different user actions. In some cases, the actions for the return values are different when the page displays in the Microsoft Dynamics NAV Web client than in the Microsoft Dynamics NAV Windows client.

Return value Microsoft Dynamics NAV Windows client Microsoft Dynamics NAV Web client
OK To close the page window, the user does one of the following:

- Chooses the OK button.
- Chooses the X button when there was no Cancel button on the window.
- Presses the Esc key when there is no Cancel button on the window.
To close the page window, the user does one of the following:

- Chooses the Close button.
- Chooses the X button when there is no Cancel button on the window.
Cancel To close the page window, the user does one of the following:

- Chooses the Cancel button.
- Chooses the X button when there is a Cancel button on the window.
- Presses the Esc key when there is a Cancel button on the window.
To close the page window, the user does one of the following:

- Chooses the Cancel button.
- Chooses the X button when there is a Cancel button on the window.
LookupOK To close a lookup window, the user does one of the following:

- Chooses the OK button.
- Chooses an item in the Lookup window.
To close a lookup window, the user chooses the OK button.
LookupCancel To close a lookup window, the user chooses the Cancel button. Same as Microsoft Dynamics NAV Windows client.
Yes To close a confirmation window, the user selects Yes. Same as Microsoft Dynamics NAV Windows client.
No To close a confirmation window, the user does one of the following:

- Chooses the No button.
- Chooses the X button.
- Presses the Esc key.
To close a confirmation window, the user does one of the following:

- Chooses the No button.
- Chooses the X button.
RunObject The user selected an option that ran another Dynamics NAV object. Same as Microsoft Dynamics NAV Windows client.
RunSystem The user selected an option that ran an external program. Same as Microsoft Dynamics NAV Windows client.

Remarks

If you know the specific page that you want to run when you are designing your application, then you can create a Page variable, set the Subtype of the variable to a specific page, and then use this function or the RUN Function (Page).

If you do not know the specific page that you want to run, then use the PAGE.RUN Function or the PAGE.RUNMODAL Function and specify the page in the Number parameter.

After you define the page variable, you can use it before and after you run the page. If you use the PAGE.RUN Function, then you can only use the variable before you run the page.

Example

This example shows how to use this function. Assume that the SomePage variable has been defined as Page 1.

CLEAR(SomePage)  
SomePage.XXX; // Any user-defined function  
SomePage.SETTABLEVIEW(MyRecord);  
SomePage.SETRECORD(MyRecord);  
IF SomePage.RUNMODAL = Action::LookupOK THEN  
  SomePage.GETRECORD(MyRecord)...  

Note

This code example includes the CLEAR Function to make sure that the variable has been cleared.

See Also

Page Data Type