responding_20to_20mouse_20double-clicks
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
responding_20to_20mouse_20double-clicks [2018/03/31 13:19] – external edit 127.0.0.1 | responding_20to_20mouse_20double-clicks [2024/01/05 00:21] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
=====Responding to mouse double-clicks===== | =====Responding to mouse double-clicks===== | ||
- | //by Richard Russell, October 2015//\\ \\ By default the [[http:// | + | //by Richard Russell, October 2015//\\ \\ By default the [[http:// |
+ | |||
+ | <code bb4w> | ||
SYS " | SYS " | ||
SYS " | SYS " | ||
- | This code should be executed just once during the initialisation phase of your program (use the **Windows Constants utility** to add declarations for the GCL_STYLE and CS_DBLCLKS constants in the usual way).\\ \\ Secondly, you need to modify your ON MOUSE event handler to examine the **@msg%** system variable in order to discover whether the interrupt was caused by a single or double click. @msg% will have one of the following values:\\ | + | </ |
+ | |||
+ | This code should be executed just once during the initialisation phase of your program (use the **Windows Constants utility** to add declarations for the GCL_STYLE and CS_DBLCLKS constants in the usual way).\\ \\ Secondly, you need to modify your ON MOUSE event handler to examine the **@msg%** system variable in order to discover whether the interrupt was caused by a single or double click. @msg% will have one of the following values: | ||
| WM_LBUTTONDOWN\\ | Left button click\\ | | | WM_LBUTTONDOWN\\ | Left button click\\ | | ||
Line 12: | Line 16: | ||
| WM_MBUTTONDBLCLK\\ | Middle button double-click\\ | | | WM_MBUTTONDBLCLK\\ | Middle button double-click\\ | | ||
| WM_RBUTTONDBLCLK\\ | Right button double-click\\ | | | WM_RBUTTONDBLCLK\\ | Right button double-click\\ | | ||
- | There are various different approaches that may be adopted, but a simple asynchronous (polling) method is as follows:\\ \\ | + | |
+ | There are various different approaches that may be adopted, but a simple asynchronous (polling) method is as follows: | ||
+ | |||
+ | <code bb4w> | ||
REM. During initialisation: | REM. During initialisation: | ||
DIM Mouse%(2), mous%(2) | DIM Mouse%(2), mous%(2) | ||
Line 20: | Line 27: | ||
mous%() = 0 | mous%() = 0 | ||
SWAP mous%(), Mouse%() | SWAP mous%(), Mouse%() | ||
- | On receiving a mouse click **mous%(0)** will contain the **@msg%** value, **mous%(1)** will contain the **@wparam%** value (which contains information on whether the Shift and/or Control keys were pressed) and **mous%(2)** will contain the **@lparam%** value (which contains information on the position of the mouse when it was clicked). See the description of [[http:// | + | </ |
+ | |||
+ | On receiving a mouse click **mous%(0)** will contain the **@msg%** value, **mous%(1)** will contain the **@wparam%** value (which contains information on whether the Shift and/or Control keys were pressed) and **mous%(2)** will contain the **@lparam%** value (which contains information on the position of the mouse when it was clicked). See the description of [[http:// | ||
+ | |||
+ | <code bb4w> | ||
ON MOUSE PROCmouse(@msg%, | ON MOUSE PROCmouse(@msg%, | ||
- | \\ | + | </ |
+ | |||
+ | Note that when the user double-clicks the mouse you may well receive a ' |
responding_20to_20mouse_20double-clicks.1522502377.txt.gz · Last modified: 2024/01/05 00:16 (external edit)