PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Events managed by default
  • Optional events
  • Optional events for managing the off-line mode
  • Optional event to manage the navigation history
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Events managed by default
WEBDEV - Server codeWEBDEV - Browser codeWindowsLinux WEBDEV manages the following events by default (order of appearance in the code editor):
EventRuntime condition
Global declarations
(Server code)
Declaring the variables global to the page. This is the first code run when opening the page.
Initialization
(Server code)
Run when opening the page.
The events are run in the following order:
  • Initializing the page controls.
  • Initializing the page.
Loading (onload) of the page
(Browser code)
Browser code run when the page is displayed in the browser (performed by PageDisplay or PageRefresh for example).
Unload (onunload) of the page
(Browser code)
Browser code run when a new page is displayed in the browser.
Versions 19 and later
Refreshing the page data
(Server code)
New in version 19
Refreshing the page data
(Server code)
Refreshing the page data
(Server code)
Event available only if the automatic data refresh was defined for the page (see Refreshing the page data). This event is run when the page is refreshed. It is used for example to update the requested controls: filling a list, ... This is an Ajax event.
If this event returns False, the event "After refreshing the page data (Browser code)" is not run.
Versions 24 and later
Request for refreshing the display
(Server code)
New in version 24
Request for refreshing the display
(Server code)
Request for refreshing the display
(Server code)
Used to group the code for updating the page controls: content of controls, status (visible, grayed, etc.), caption to refresh, etc.
This event may expect parameters. Simply declare a procedure in the event. For example:
// Request for refreshing the display
PROCEDURE AskForRefresh(RefreshType is boolean)
This event is started upon request by the following functions:
When these functions are called, you can specify the value of the parameters expected by the event.
Versions 19 and later
After refreshing the page data
(Browser code)
New in version 19
After refreshing the page data
(Browser code)
After refreshing the page data
(Browser code)
Event available only if the automatic data refresh was defined for the page (see Refreshing the page data).
This event is run after the "Refreshing the page data (server code)". It is used to perform an additional process on the browser. If the event "Refreshing the page data (Server code)" returns False, the event "After refreshing the page data (Browser code)" is not run.
Close the page
(Server code)
Run when closing the page.
Synchronization of the page
(Server code)
Server code used to manage the page synchronization when clicking the browser "Back" button. See Managing the browser "Back" button for more details.

Remark: Only the browser codes are available in a static page.
PHP In PHP, the following WLanguage events are associated with pages:
EventRuntime condition
Declaration of global variables (Server code)Declaring the variables global to the page. This is the first code run when opening the page.
Initialization (Server code)Case 1: Page with context:
Run once during the first display of the page to initialize the context.
The events are run in the following order:
  • Initializing the page controls.
  • Initializing the page.
Case 2: Page without context:
Run whenever the page is displayed. Used to run a process whenever the server redisplays the page (a process used to check whether the Web user is identified by his login for example).
The events are run in the following order:
  • Initializing the page controls.
  • Initializing the page.
1st display of the page (Server code)For the PHP pages without context
Run once during the first display of the page.
The events are run in the following order:
  • Initializing the page controls.
  • Initializing the page.
Versions 16 and later
Whenever the page is displayed (Server code)
New in version 16
Whenever the page is displayed (Server code)
Whenever the page is displayed (Server code)
For the PHP pages with context
Run whenever the page is displayed. Used to run a process whenever the server redisplays the page (a process used to check whether the Web user is identified by his login for example).
Reminder: The "Initializing" event of the page is run once, the first time the page is displayed to initialize the context.
For an Ajax page, this event is run for each request made to the server.
Loading (onload) the page (Browser code)Browser code run when the page is displayed in the browser (performed by PageDisplay or PageRefresh for example).
Unloading (onunload) the page (Browser code)Browser code run when a new page is displayed in the browser.

For example, in a PHP page without context:
  • During the initialization, a Combo Box control that lists the titles is filled with "Madam"+ CR + "Mister".
  • During the first display, the default title is selected ("Mister").
For example, in a PHP page with context:
  • During the initialization, a Combo Box control that lists the titles is filled with "Madam"+ CR + "Mister" and the default title is selected ("Mister").
  • During each display, a test about the consistency of control or about the consistency of control update is run (counter of visits, ...).
Related Examples:
WW_Forum_PHP Complete examples (WEBDEV): WW_Forum_PHP
[ + ] This example proposes the main features of a user forum (creation of forums, topics and messages, moderator, search, etc.)

Some of the features used by WW_FORUM_PHP:
- Rich control
- AJAX
-...
WW_Blogs_php Complete examples (WEBDEV): WW_Blogs_php
[ + ] This example is a PHP site created with WEBDEV for managing blogs.
A blog is a log or a diary on an Internet site.
It can be consulted by everyone and everyone can write his own comments.
The author of the blog writes messages whenever he wants to.
You have the ability to format the text, to include images, notes, and so on.
Furthermore, each blog can be exported in RSS.
Optional events
Several optional events can be managed.
To add an optional event:
  1. Select the requested control.
  2. Display the code window of this control (F2 key).
  3. Click the link "Add other events to xxx" at the bottom of the window code, after the last event.
  4. All the optional events available for the control are displayed.
  5. Check the optional event to add and validate.
    Remark: You can select several optional events.
  6. The selected optional event is automatically added to the events managed by the control.
To disable an optional event, simply perform the same operations to display the list of optional events. Then simply uncheck the optional events to delete.
Remark: If the disabled code contains WLanguage code, this code is automatically deleted.
You can manage, for example:
  • the left mouse button down, up, with a double click,
  • the right mouse button down, up, with double click, ...
See the Optional events for more details.
Versions 16 and later

Optional events for managing the off-line mode

Several optional events can be used to optimize the management of offline sites:
EventRuntime condition
Switch to off-line mode (Browser code)Run when switching to off-line mode.
Switch to on-line mode (Browser code)Run when switching to on-line mode.
Whenever the status of the HTML cache changes (Browser code)This event is used to check what happens when the page is loaded. This event is called whenever the cache is checked.
The following command line is used to retrieve the actions performed by the browser:
Trace(JSInfoEvent("type"))
You have the ability to find out:
  • whether the browser is currently updating the cache,
  • whether an error occurs
  • whether the update of the cache is completed
  • whether no update must be performed, ....
New in version 16

Optional events for managing the off-line mode

Several optional events can be used to optimize the management of offline sites:
EventRuntime condition
Switch to off-line mode (Browser code)Run when switching to off-line mode.
Switch to on-line mode (Browser code)Run when switching to on-line mode.
Whenever the status of the HTML cache changes (Browser code)This event is used to check what happens when the page is loaded. This event is called whenever the cache is checked.
The following command line is used to retrieve the actions performed by the browser:
Trace(JSInfoEvent("type"))
You have the ability to find out:
  • whether the browser is currently updating the cache,
  • whether an error occurs
  • whether the update of the cache is completed
  • whether no update must be performed, ....

Optional events for managing the off-line mode

Several optional events can be used to optimize the management of offline sites:
EventRuntime condition
Switch to off-line mode (Browser code)Run when switching to off-line mode.
Switch to on-line mode (Browser code)Run when switching to on-line mode.
Whenever the status of the HTML cache changes (Browser code)This event is used to check what happens when the page is loaded. This event is called whenever the cache is checked.
The following command line is used to retrieve the actions performed by the browser:
Trace(JSInfoEvent("type"))
You have the ability to find out:
  • whether the browser is currently updating the cache,
  • whether an error occurs
  • whether the update of the cache is completed
  • whether no update must be performed, ....
Versions 23 and later

Optional event to manage the navigation history

A specific optional event is available to optimize the management of Back/Next buttons: "Move into the navigation history (onpopstate)".
This event expects the data to display, as parameter. This data was stored in the history by BrowserHistoryAdd and BrowserHistoryModify.
If the Web user goes back to an entry in the history, the stored data will be transmitted to the "Move in the navigation history" event (optional page event). This event must process the data in order to restore the page status. This process must be associated with a procedure that expects the transmitted data in parameter:
// Event "Move in the navigation history (onpopstate)"
PROCEDURE <ProcedureName>(<Data>)
Example: This example adds the page into the history and stores the insertion time. Going back to the previous history page displays the time.
x is Variant
x.Time = TimeSys()
BrowserHistoryAdd(x, MyPage..Title, "#before")
 
x.Time = TimeSys()
BrowserHistoryAdd(x, MyPage..Title, "#after")
// Event "Move in the navigation history (onpopstate)"
PROCEDURE ProcessHistory(stStatus)
Info(stStatus.Time)
Note: Depending on the browser, the event "Move in the navigation history (onpopstate)" is also run when loading the page and when going back to the initial page display. In this case, the <Data> parameter transmitted to the event corresponds to Null.
New in version 23

Optional event to manage the navigation history

A specific optional event is available to optimize the management of Back/Next buttons: "Move into the navigation history (onpopstate)".
This event expects the data to display, as parameter. This data was stored in the history by BrowserHistoryAdd and BrowserHistoryModify.
If the Web user goes back to an entry in the history, the stored data will be transmitted to the "Move in the navigation history" event (optional page event). This event must process the data in order to restore the page status. This process must be associated with a procedure that expects the transmitted data in parameter:
// Event "Move in the navigation history (onpopstate)"
PROCEDURE <ProcedureName>(<Data>)
Example: This example adds the page into the history and stores the insertion time. Going back to the previous history page displays the time.
x is Variant
x.Time = TimeSys()
BrowserHistoryAdd(x, MyPage..Title, "#before")
 
x.Time = TimeSys()
BrowserHistoryAdd(x, MyPage..Title, "#after")
// Event "Move in the navigation history (onpopstate)"
PROCEDURE ProcessHistory(stStatus)
Info(stStatus.Time)
Note: Depending on the browser, the event "Move in the navigation history (onpopstate)" is also run when loading the page and when going back to the initial page display. In this case, the <Data> parameter transmitted to the event corresponds to Null.

Optional event to manage the navigation history

A specific optional event is available to optimize the management of Back/Next buttons: "Move into the navigation history (onpopstate)".
This event expects the data to display, as parameter. This data was stored in the history by BrowserHistoryAdd and BrowserHistoryModify.
If the Web user goes back to an entry in the history, the stored data will be transmitted to the "Move in the navigation history" event (optional page event). This event must process the data in order to restore the page status. This process must be associated with a procedure that expects the transmitted data in parameter:
// Event "Move in the navigation history (onpopstate)"
PROCEDURE <ProcedureName>(<Data>)
Example: This example adds the page into the history and stores the insertion time. Going back to the previous history page displays the time.
x is Variant
x.Time = TimeSys()
BrowserHistoryAdd(x, MyPage..Title, "#before")
 
x.Time = TimeSys()
BrowserHistoryAdd(x, MyPage..Title, "#after")
// Event "Move in the navigation history (onpopstate)"
PROCEDURE ProcessHistory(stStatus)
Info(stStatus.Time)
Note: Depending on the browser, the event "Move in the navigation history (onpopstate)" is also run when loading the page and when going back to the initial page display. In this case, the <Data> parameter transmitted to the event corresponds to Null.
Minimum version required
  • Version 10
Comments
Click [Add] to post a comment