Page.RunModal() Method

Version: Available or changed with runtime version 1.0.

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: Page
An instance of the Page data type.

Return Value

[Optional] Action
Type: Action
Specifies what action the user took on the page.

Specifies what action the user took on the page. The following table shows the possible return values for the different user actions.

Return valueDescription
OKTo 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.
CancelTo 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.
LookupOKTo close a lookup window, the user chooses the OK button.
LookupCancelTo close a lookup window, the user chooses the Cancel button.
YesTo close a confirmation window, the user selects Yes.
NoTo close a confirmation window, the user does one of the following:

- Chooses the No button.
- Chooses the X button.
RunObjectThe user selected an option that ran another object.
RunSystemThe user selected an option that ran an external program.

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 method or the Run method (Page).

If you don't know the specific page that you want to run, then use the Run method (Page) or the RunModal Method (Page) 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 Run method (Page), then you can only use the variable before you run the page.

Example

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

Clear(SomePage);
SomePage.XXX; // Any user-defined method
SomePage.SetTableView(MyRecord);
SomePage.SetRecord(MyRecord);
if SomePage.RunModal = Action::LookupOK then
  SomePage.GetRecord(MyRecord)...

Note


This code example includes the Clear method to make sure that the variable has been cleared.

Page Data Type
Get Started with AL
Developing Extensions