ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing an application or website / Controls, windows and pages / Page
  • Passing parameters to a page when it is opened
  • To pass parameters to a page when it is opened:
  • Running the test of a page with parameters
  • Notes
  • Parameters passed by value
  • Giving a default value to the parameter in the declaration
  • Scope of parameters
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Page with 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.
Caution: 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.
// -- Global declarations of PAGE_CALENDAR --
 
PROCEDURE PAGE_Calendar(sSelDate)
// sSelDate: date specifying the date to select.
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 in parameter.
// -- Click code of BTN_CALENDAR --
 
// Open PAGE_CALENDAR
// Today's date is passed as parameter
PageDisplay(PAGE_CALENDAR, Today())
Running the test of a page with parameters
To run the test of a page with parameters:
  1. Open the page with parameters in the page editor.
  2. Click (or press F9). The following window is displayed:
  3. 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.
  4. Validate. The page is displayed according to the specified values.
Notes

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:
  1. The MyDate variable is declared in the code of BTN_CALENDAR. This variable contains today's date (for example: MyDate = Today()).
  2. This variable is passed in parameter to PAGE_CALENDAR. The sSelDate parameter contains the value of the MyDate variable.
  3. The value of the sSelDate parameter is modified in PAGE_CALENDAR (for example: sSelDate = "20020701")
  4. 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:
// -- Global declarations of PAGE_CALENDAR --
 
PROCEDURE PAGE_Calendar(sSelDate = 20030101)
// sSelDate: date specifying the date to select.

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.).
See also
Minimum version required
  • Version 9
Comments
Click [Add] to post a comment

Last update: 04/13/2023

Send a report | Local help