Otherwise, responding to mouse events via the CallBack function is the primary approach PowerBASIC programmers use to respond to user mouse actions.
Client Area Messages
These messages are sent to windows when a mouse event (press or release) occurs within the window's client area.
WM_LBUTTONDBLCLK WM_LBUTTONDOWN WM_LBUTTONUP WM_MBUTTONDBLCLK WM_MBUTTONDOWN WM_MBUTTONUP WM_RBUTTONDBLCLK WM_RBUTTONDOWN WM_RBUTTONUP
The x/y coordinates of the mouse hot spot are in the low-order/hi-order word, respectively, of lParam.
area. The system posts the WM_MOUSEMOVE message to the window when the user moves the cursor within the client area. WM_CAPTURECHANGED - sent to window losing mouse capture WM_MOUSEACTIVATE - set top-level window as active WM_MOUSEHOVER - hovers over the client area for a certain time period WM_MOUSEHWHEEL - detects movement of mouse wheel WM_MOUSELEAVE - leaves the client area WM_MOUSEMOVE - moves within the client area WM_MOUSEWHEEL - detects movement of mouse wheel WM_NCHITTEST - determines if mouse event was in client/non-client area =============Non-Client Area
Non-Client Area Messages
A window also receives a message when a mouse event occurs in the window, but outside the client area - border, menu bar, title bar, scroll bar, window menu, minimize button, and maximize button.
These non-client messages are generated primarily for use by Windows. There is a corresponding non-client area mouse message for each client area mouse message.
WM_NCLBUTTONDBLCLK WM_NCLBUTTONDOWN WM_NCLBUTTONUP WM_NCMBUTTONDBLCLK WM_NCMBUTTONDOWN WM_NCMBUTTONUP WM_NCMOUSEHOVER WM_NCMOUSELEAVE WM_NCMOUSEMOVE WM_NCRBUTTONDBLCLK WM_NCRBUTTONDOWN WM_NCRBUTTONUP
Windows supports a mouse with 5 buttons. in addition to the left, middle, and right buttons there are XBUTTON1 and XBUTTON2, which provide backward and forward navigation when internet browsers.
These messages are provided:
WM_XBUTTONDBLCLK - client area WM_XBUTTONDOWN - client area WM_XBUTTONUP - client area WM_NCXBUTTONDBLCLK - non-client area WM_NCXBUTTONDOWN - non-client area WM_NCXBUTTONUP - non-client areaThe HIWORD of the WPARAM in these messages contains a flag indicating which X button was pressed.
Capturing Mouse Events
Most programmer effort related to mouse control takes place in a Callback Function, responding to mouse events.
The properties of a mouse depends on the software drivers supporting the mouse. The Control Panel/Mouse applet is typically used to make changes to the action of the mouse, such as button configurations, pointer options, wheel features and set points.
Here's an example of the MOUSEPTR statement.
MOUSEPTR iStyle& TO iResult& 'TO is optionaliResult is set to zero if the operation fails, or to a handle for the old cursor if it succeeds. The handle may be used to restore the cursor by using it in place of iStyle&
iStyle options are:
0 - Hide 1 - Arrow 2 - Cross 3 - I-Beam 4 - Arrow 5 - Sizing pointer (all directions) 6 - Sizing pointer (NE-SW diagonal) 7 - Sizing pointer (vertical) 8 - Sizing pointer (NW-SE diagonal) 9 - Sizing pointer (horizontal) 10 - Up arrow 11 - Hourglass 12 - No mouse pointer 13 - App Starting (arrow with an hourglass)
If you have any suggestions or corrections, please let me know.