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 value Description
OK 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.
LookupOK To close a lookup window, the user chooses the OK button.
LookupCancel To close a lookup window, the user chooses the Cancel button.
Yes To close a confirmation window, the user selects Yes.
No 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 object.
RunSystem The 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 do not 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.

See Also

Page Data Type
Getting Started with AL
Developing Extensions