|
|
|
|
|
- Calling the same event several times on the same object
- Procedure called by Event
- Parameters used by the procedure
- Events used by WINDEV
Event (Function) In french: Evénement Intercepts a Windows event on a control, a group of controls or a WINDEV or WINDEV Mobile window. A specific WLanguage procedure is automatically run when the event is triggered on the specified object. To end the management of the event, all you have to do is use EndEvent. Remark: Event does not operate on a non-WINDEV window. // Capture the mouse click on an edit control WM_LBUTTONDOWN is int = 513 Event(MouseClick, "EDT_EDIT1", WM_LBUTTONDOWN)
// MouseClick procedure PROCEDURE MouseClick() EDT_EDIT1 = "" Â // Reset the control to 0 when it is clicked
Syntax
<Result> = Event(<WLanguage procedure> , <Object name> , <Windows message>)
<Result>: Integer - Identifier of event,
- 0 if an error occurs.
<WLanguage procedure>: Procedure name Name of WLanguage procedure that will be run when intercepting the event. This procedure can be a global procedure of the project or a local procedure of the window that contains the code currently run. This function must comply with a specific standard (see the Remarks). For a given object, a single procedure can intercept a given event. <Object name>: Character string Name of control, group of controls or WINDEV window on which the event will be managed. You also have the ability to use the following generic character strings: | | <Window name>.* | The event is managed for all the controls found in <Window name> (except for <Window name> itself). | .* (dot star) | The event is managed for all the controls found in the current window (except for the window itself). | *. (star dot) | The event is managed in all WINDEV windows of current application. | *.* (star dot star) | The event is managed in all WINDEV windows and in all controls of all opened WINDEV windows found in the current application. |
<Windows message>: Integer or character string Number or name of Windows message to manage. See the list of Windows events. Remark: The Windows constants can be directly included in your WLanguage code via the EXTERN keyword. If this parameter corresponds to a character string, this string is case-sensitive. If this parameter corresponds to 0, all the Windows messages are intercepted. Remarks Calling the same event several times on the same object Event can be used to manage the same event several times for the same element (control, window, etc.). In this case, the events are "stacked": - the first event is managed until the next event is called.
- when an event is not managed anymore (EndEvent), the event found immediately before it (if it exists) is taken into account.
Procedure called by Event The interception procedure called by Event must have the following format: FUNCTION ProcedureManageEvent(WindowsMessage, wParam, IParam) WindowsMessage, wParam and lParam are three optional integers, used to send and to receive information about the message and the relevant objects. Parameters used by the procedure The interception procedure called by Event can use the following variables: | | | Variables | Meaning | 5.5 variable kept for backward compatibility |
---|
MySelf..Name | Name of the object (control, group of controls or window) Read-only variable | _EVE.name | Message | Number of the message (first parameter of the procedure) Read-only variable | _EVE.wMessage | wParam | First parameter of the message (second parameter of the procedure) Read-only variable | _EVE.wParam | lParam | Second parameter of the message (third parameter of the procedure) Read-only variable | _EVE.lParam | Handle("") | Handle of the object that received the message Read-only variable | _EVE.hWnd | Value returned by the procedure | Returns a value to Windows | _EVE.Return | Remark: If the process returns a value (an integer), the Windows event is stopped: this value is returned. If the process returns NO value, the execution continues. Events used by WINDEV WINDEV uses the events included between "WM_USER + 700" and "WM_USER + 1200". Therefore, other ranges of events must be used ("WM_USER + 1300" to "WM_USER + 1400" for example).
Related Examples:
|
Training (WINDEV): WD Screen Saver
[ + ] This example illustrates the creation of a screen saver with the WLanguage functions. The following topics are presented in this example: 1/ the periodic call to a procedure ("timers") 2/ the management of Windows events 3/ the system functions (call to Windows APIs) To use the screen saver: - Rename the executable (.EXE) to.SCR - Copy the file to the directory of Windows (Ex: C:\WINDOWS) - Open the window for the display properties of the desktop - Choose the "Screen Saver" tab - Select the screen saver generated by WINDEV
|
|
Complete examples (WINDEV): WD Schedule
[ + ] This example presents the management of a graphic schedule. The following topics are presented in this example: 1/ the scheduler control 2/ the Google Calendar functions
|
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|