ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing an application or website / Controls, windows and pages / Controls: Options and actions
  • Overview
  • Actions performed by the user
  • MK_XX constants
  • VK_XX constants
  • SB_XXX constants
  • SIZE_XXX constants
  • Examples
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
Overview
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 eventInformation returned in the _EVE.LParam variableInformation 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_CONTROL8Ctrl key down.
MK_LBUTTON1Left mouse button down.
MK_MBUTTON16Middle mouse button down.
MK_RBUTTON2Right mouse button down.
MK_SHIFT4Shift 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 details of the VK_XXX constants are stored in the "KeyConst.WL" file in the "Personal\External" subdirectory of the WINDEV installation directory.
Before using these constants, you must enter the following line of code:
EXTERN "KeyConst.WL"

SB_XXX constants

The SB_XXX constants are as follows:
The scrollbar box was moved by:
SB_LINEDOWN1the spin button at the bottom
SB_LINEUP0the spin button at the top
SB_LINELEFT0the spin button on the left
SB_LINERIGHT1the spin button on the right
SB_PAGEDOWN3the scrollbar below the scrollbar box
SB_PAGEUP2the scrollbar above the scrollbar box
SB_PAGELEFT2the scrollbar on the left of the scrollbar box
SB_PAGERIGHT3the scrollbar on the right of the scrollbar box
SB_THUMBPOSITION4the scrollbar box
SB_THUMBTRACK5the 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_MAXIMIZED2The window is maximized
SIZE_MINIMIZED1The window is minimized
SIZE_RESTORED0The 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
Examples
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
WINDEVWindows The following example is used to add the window icon into the task bar when the window is minimized and to remove it when the window is maximized.
// -- Optional event: Resizing 
// Declare the constants 
CONSTANT 
SIZE_RESTORED=0 
SIZE_MINIMIZED=1 
SIZE_MAXIMIZED=2
END 

// Add the "C:\Icons\Icon.ICO" icon to the taskbar 
// when the window is minimized 
IF _EVE.wParam = SIZE_MINIMIZED THEN 
SysIconAdd("C:\Icons\Icon.ICO") 
END 

// Delete the "C:\Icons\Icon.ICO" icon 
// when the window is restored 

IF _EVE.wParam = SIZE_RESTORED THEN SysIconDelete()
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
Minimum version required
  • Version 17
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/08/2023

Send a report | Local help