PAGE.RUNMODAL Function
Creates, runs, and closes a specified page object. When a page is run modally, no input (keyboard or mouse click) can occur except to objects on the modal page.
[Action :=] Page.RUNMODAL(Number[, Record][, Field])
Parameters
- Number
-
Type: Integer
The number of the page that you want to run. If you enter zero (0), the default lookup window for the current page is displayed. Click View and then click C/AL Symbols Menu to select the page from a list.
If the page you specify does not exist, a run-time error occurs.
- Record
-
Type: Record
This function shows, by default, the record last displayed on the page. For each object, the system stores information about the most recently shown record and the attached key and filters.
Use this optional parameter to select a specific record to display on the page. The record must be of the same type as the table attached to the page. When the record is displayed, the key and filters attached to the record are used.
- Field
-
Type: Field
Use this optional parameter to select a specific field on which focus will be placed.
Type: Code
Specifies what action the user took. The following table shows the possible return values.
| Return value | Description |
|---|---|
|
OK |
The user selected OK to exit the window |
|
Cancel |
The user selected Cancel to exit the window |
|
LookupOK |
The user selected OK on a lookup window |
|
LookupCancel |
The user selected Cancel on a lookup window |
|
Yes |
The user selected Yes |
|
No |
The user selected No |
|
Close |
The user selected Close, ESC, or closed the window using the title bar |
|
FormHelp |
The user selected Help |
|
RunObject |
The user selected an option that ran another object |
|
RunSystem |
The user selected an option that ran an external program |
The page is run modally. If, at design time, you do not know the specific page you want to run, then use this function or the PAGE.RUN Function.
If you do know the specific page you want to run, then you can use the RUN Function (Page) or RUNMODAL Function (Page) to specify a variable.
When you want to close the page, use CurrPage.CLOSE. CurrPage is a predefined system variable.
It is important to remember that pages that have been created by transforming existing forms still use the same code as the original forms. Furthermore, when you compile your code to C#, forms and pages are both treated as forms.
If, from a page, you call another form that does not have a corresponding page, you will receive an error message.
If you run this page function on a Classic client, you receive an error because the Classic client does not support pages.