|
|
|
|
- Overview
- Actions performed by the user
- MK_XX constants
- VK_XX constants
- SB_XXX constants
- SIZE_XXX constants
- Examples
Optional events: Retrieved information
In WINDEV, you can add optional events in the code of the different elements of an application. For more details, see Optional events. Depending on the optional event used, specific information can be retrieved via the _EVE.LPARAM and _EVE.WPARAM variables. Actions performed by the user The table below presents the information returned in the different optional events: | | | Optional event | Information returned in the _EVE.LParam variable | Information returned in the _EVE.WParam variable |
---|
Mouse hover (WM_MOUSEMOVE)
Left mouse button down (WM_LBUTTONDOWN)
Left mouse button up (WM_LBUTTONUP)
Double click with the left mouse button (WM_LBUTTONDBLCLK)
Right mouse button down (WM_RBUTTONDOWN)
Right mouse button up (WM_RBUTTONUP)
Double click with the right mouse button (WM_RBUTTONDBLCLK) | - High byte (returned by HiWord): Vertical position (Y) of mouse cursor in relation to the specified control or window (equivalent to MouseYPos).
- Low byte (returned by LoWord): Horizontal position (X) of mouse cursor in relation to the specified control or window (equivalent to MouseXPos).
| Key pressed in the format of a MK_XXX constant | Mouse wheel (WM_MOUSEWHEEL) | - High byte (returned by HiWord): Vertical position (Y) of mouse cursor in relation to the specified control or window (equivalent to MouseYPos).
- Low byte (returned by LoWord): Horizontal position (X) of mouse cursor in relation to the specified control or window (equivalent to MouseXPos).
| - High byte (returned by HiWord): Rotational direction of mouse wheel (positive number: move to the top ; negative number: move to the bottom)
- Low byte (returned by LoWord): Key pressed in the format of a MK_XXX constant
| Key down (WM_KEYDOWN) Key up (WM_KEYUP) | | Key pressed in the format of a VK_XXX constant | Key pressed (WM_CHAR) | | ASCII code of the key pressed (can be handled by Charact) | System key down (WM_SYSKEYDOWN) System key up (WM_SYSKEYUP) | | Key pressed in the format of a VK_XXX constant | System key pressed (WM_SYSCHAR) | | ASCII code of the system key pressed | Horizontal scrollbar (WM_HSCROLL) Vertical scrollbar (WM_VSCROLL) | Handle of scrollbar | - High byte (returned by HiWord): Position of scrollbar box
- Low byte (returned by LoWord): Method used to move the scrollbar box, in the format of an SB_XXX constant
| Display of context menu (WM_CONTEXTMENU) | - High byte (returned by HiWord): Vertical position (Y) of mouse cursor in relation to the specified control or window (equivalent to MouseYPos).
- Low byte (returned by LoWord): Horizontal position (X) of mouse cursor in relation to the specified control or window (equivalent to MouseXPos).
Remark: If these values are equal to -1, the context menu was opened by the Windows key for opening the context menu | Handle of window or control from which the context menu is called | Move (WM_MOVE) | - High byte (returned by HiWord):
- vertical position of the upper-left corner of the window relative to the upper-left corner of the screen (equivalent to the Y property)
- vertical position of the upper-left corner of the control relative to the upper-left corner of the window client area (equivalent to the Y property).
- Low byte (returned by LoWord):
- horizontal position of the upper-left corner of the window relative to the upper-left corner of the screen (equivalent to the X property)
- horizontal position of the upper-left corner of the control relative to the upper-left corner of the client area of the window (equivalent to the X property).
| | Resize (WM_SIZE) | - High byte (returned by HiWord): Height of control or window (equivalent to Height).
- Low byte (returned by LoWord): Width of control or window (equivalent to Width).
| Display mode of window (minimized, maximized, ...) in the format of a SIZE_XXX constant (equivalent to WinSize). | Gain focus (WM_SETFOCUS) | | Handle of window or control that took focus. | Lose focus (WM_KILLFOCUS) | | Handle of window or control that took focus. |
MK_XX constants The MK_XXX constants are as follows:
| | | MK_CONTROL | 8 | Ctrl key down. | MK_LBUTTON | 1 | Left mouse button down. | MK_MBUTTON | 16 | Middle mouse button down. | MK_RBUTTON | 2 | Right mouse button down. | MK_SHIFT | 4 | Shift key down |
Before using these constants, you must type the following lines of code: CONSTANT MK_CONTROL=8 MK_LBUTTON=1 MK_MBUTTON=16 MK_RBUTTON=2 MK_SHIFT=4 END VK_XX constants The VK_XXX constants are presented in details in the "KeyConst.WL" file found in the "Personal\Extern" sub-directory of the setup directory of WINDEV. Before using these constants, you must enter the following line of code: SB_XXX constants The SB_XXX constants are as follows:
| | | | | The scrollbar box was moved by: |
---|
SB_LINEDOWN | 1 | the spin button at the bottom | SB_LINEUP | 0 | the spin button at the top | SB_LINELEFT | 0 | the spin button on the left | SB_LINERIGHT | 1 | the spin button on the right | SB_PAGEDOWN | 3 | the scrollbar below the scrollbar box | SB_PAGEUP | 2 | the scrollbar above the scrollbar box | SB_PAGELEFT | 2 | the scrollbar on the left of the scrollbar box | SB_PAGERIGHT | 3 | the scrollbar on the right of the scrollbar box | SB_THUMBPOSITION | 4 | the scrollbar box | SB_THUMBTRACK | 5 | the scrollbar box |
Before using these constants, you must enter the following lines of code: CONSTANT SB_LINEDOWN=1 SB_LINEUP=0 SB_LINELEFT=0 SB_LINERIGHT=1 SB_PAGEDOWN=3 SB_PAGEUP=2 SB_PAGELEFT=2 SB_PAGERIGHT=3 SB_THUMBPOSITION=4 SB_THUMBTRACK=5 END SIZE_XXX constants The SIZE_XXX constants are as follows: | | | SIZE_MAXIMIZED | 2 | The window is maximized | SIZE_MINIMIZED | 1 | The window is minimized | SIZE_RESTORED | 0 | The window is restored |
Before using these constants, you must enter the following line of code: CONSTANT SIZE_RESTORED=0 SIZE_MINIMIZED=1 SIZE_MAXIMIZED=2 END The following example is used to find out the rotational direction of the mouse wheel: // -- Optional event: Mouse wheel Direction is int Direction = HiWord(_EVE.wParam) IF Direction < 0 THEN Trace("The mouse wheel is going to the bottom") ELSE Trace("The mouse wheel is going to the top") END The following example is used to delete the current row from a table when the Del key is pressed: // -- Optional event: Key up // Include the "KeyConst.wl" file that contains // the standard Windows constants EXTERN "KeyConst.WL" // [Del] key up? IF _EVE.wParam = VK_DELETE THEN // Delete the current row? IF YesNo("Delete the current row?") = Yes THEN TableDelete(MySelf) END END
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|