|
|
|
|
|
- Passing parameters to a page when it is opened
- To pass parameters to a page when it is opened:
- Testing a parameterized page
- Notes
- Parameters passed by value
- Giving a default value to the parameter in the declaration
- Scope of parameters
Passing parameters to a page when it is opened To pass parameters to a page when it is opened: 1. Declare a procedure in the "Global declarations" event of the page. The name of this procedure and the page name must be identical. The parameters of this procedure correspond to the parameters that must be passed to the page. Attention: The procedure declaration (keyword PROCEDURE) must correspond to the first line of the "Global declarations" event. For example, the PAGE_CALENDAR page is used to manage the selection of a date in a calendar. This page expects a parameter indicating the date to select.
PROCEDURE PAGE_Calendar(sSelDate)
This parameter can be handled from any event of the page (button, local procedures, etc.). For example, in the "Initialization" event of PAGE_CALENDAR: // -- Initializing PAGE_CALENDAR -- // EDT_DateControl is an edit control // It contains the value of the sSelDate parameter EDT_DateControl = sSelDate
2. Pass the parameter expected by the page when it is opened ( PageDisplay, PageUse, etc.). For example, BTN_CALENDAR is used to open PAGE_CALENDAR. When this page is opened, today's date is passed as parameter. // -- Click code of BTN_CALENDAR -- // Open PAGE_CALENDAR // Today's date is passed as parameter PageDisplay(PAGE_CALENDAR, Today())
Testing a parameterized page To run the test of a page with parameters: - Open the page with parameters in the page editor.
- Click
(or press F9). The following window is displayed: - Specify the value of the parameters that will be used to run the test of the page. To use the default value of the parameters, type the "*" character.
- Validate. The page is displayed according to the specified values.
Parameters passed by value If the parameters passed to a page are modified in this page, these modifications will be taken into account in this page only. The value of these parameters is not modified in the calling event. For example: - The MyDate variable is declared in the code of BTN_CALENDAR. This variable contains today's date (for example: MyDate = Today()).
- This variable is passed as a parameter to the PAGE_CALENDAR page.. The parameter sDateSel contains the value of the variable MaDate.
- The value of the parameter sDateSel is modified in the PAGE_CALENDAR page (for example: sDateSel = "20020701").
- The value of the MyDate variable is not modified.
Giving a default value to the parameter in the declaration A default value can be given to the parameters when declaring the parameters. For example, to give a default value in the previous example, enter the following code in the "Global declarations" event of PAGE_CALENDAR:
PROCEDURE PAGE_Calendar(sSelDate = 20030101)
Scope of parameters The parameters passed to a page are global to all the events of this page (initialization, code of a button, code of a local procedure, etc.).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|