|
|
|
|
|
InitParameter (Function) In french: InitParamètre Initializes the management of persistent values. Specifies the location used to store: - the values of the persistent controls.
- the size and position of the controls and windows.
- the values managed by SaveParameter and LoadParameter.
Remark: The initialization of persistent values is "global". Therefore, if a component initializes the management of persistent values, the management of persistent values will be initialized for the application that uses the component. Syntax
<Result> = InitParameter(<Initialization mode> [, <Source of values>])
<Result>: Character string Initialization mode used before the call to InitParameter. <Result> has the following format:
<Initialization Mode> + TAB + <Source of Values> <Initialization mode>: Integer constant Type of backup for the persistent data:
| | paramIni | The parameters will be saved in a ]Global[ section of a file in .INI format. If this option is selected:- the INI file is named <Project name>.INI by default. This file is created in the directory of the executable.
- <Source of values> corresponds to the name of the .INI file to be used.
If this directory is not specified, the file is created in the executable directory.
| paramRegistry | The parameters will be saved in the registry. If this option is selected:- by default, the entry used corresponds to the result of ProjectInfo(piRegistry) (which means HKEY_CURRENT_USER\Software\<Company>\<Project name>)
<Company> corresponds to the company specified when creating the executable. If this name is not specified, <Company> corresponds to "WINDEV applications". - in Test mode, the path used in the registry is as follows: HKEY_CURRENT_USER\SOFTWARE\PC SOFT\WinDev\30\TestMode\<Project name>.
- <Source of values> corresponds to the registry entry to be used.
| paramString | The parameters will be read in an XML string. <Source of values> (mandatory parameter) must be a string variable. In this case, the parameters are not saved in an XML file but in the string variable. This constant can be used to retrieve parameters coming from an HTTP server (parameters returned by HTTPRequest for example).
| paramXML | The parameters will be saved in a file in .XML format. If this option is selected:- the XML file is named <Project name>.XML by default. This file is created in the directory of the executable.
- <Source of values> corresponds to the name of the .XML file to be used.
If this directory is not specified, the file is created in the executable directory.
|
<Source of values>: Optional character string This parameter depends on the selected initialization mode.
Related Examples:
|
Training (WINDEV): WD Persistence
[ + ] This example presents the use of InitParameter, LoadParameter and SaveParameter. These functions are used to configure the backup of controls, variables and other parameters. This example is divided into three parts: - The configuration - The manual management of variables (SaveParameter and LoadParameter) - The optimization 1°) Configuration The configuration window enables you to modify the location of the backup of parameters (registry, INI file, XML file) as well as its path (registry key or file path). 2°) Manual management of the variables The manual management enables you to save the content of the variables via SaveParameter and to restore them via LoadParameter. Each parameter is identified by a name. These values are saved at the location defined in the configuration window. 3°) The optimization This window explains how to optimize your code to avoid the slowness caused when the saved values are restored. Indeed, when restoring the value of a control, its modification code is run. If you have long processes (queries with parameters for instance), this window shows you how to speed up the loading of the window.
|
Business / UI classification: Neutral code
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|