Gets information about the mouse's current stateint sm_ms_inquire(int request);
- Specifies the data to get, one of the following constants:
- The line of the physical display on which the mouse click occurred.
- The column of the physical display on which the mouse click occurred.
- The state of the Shift, Control, and Alt keys during the mouse click. Panther returns this information in an integer bit mask. For bit settings, refer to the Description.
- The state of all mouse buttons, left, middle, and right. Panther returns this information in an integer bit mask. For states that are recognized by Panther and their corresponding bit settings, refer to the Description.
- The number of the field in which the mouse click occurred. If the mouse click occurs outside a field, the function returns -1.
- The number of the Panther screen line on which the mouse click occurred.
- The number of the Panther screen column on which the mouse click occurred.
sm_ms_inquiregets information about the mouse's current state—the position of the last mouse click on the physical or Panther screen, whether other keys are pressed in combination with it, and which mouse buttons have been pressed and how recently.
This function's returns an integer value whose bits are set according to the supplied argument,
MOUSE_SHIFTsets the three lowest-order bits in the return value to indicate which of three keys—Shift, Ctrl, and Alt—are pressed at the same time as the mouse click.
sm_ms_inquirecan set these bits as follows, from lowest- to highest-order bit:
For example, a return value of 2 (
0 1 0) indicates that the Ctrl key is down, while a return value of 5 (
1 0 1) indicates that the Alt and Shift keys are both down. The second of these returns can be represented as follows:
MOUSE_BUTTONSsets nine bits to indicate the state of the left, right, and middle mouse buttons.
sm_ms_inquireputs the requested data in three segments of three bits each, where each segment represents one of three mouse buttons—left, right, and middle. The three lowest-order bits contain left button data; if the mouse has only one button, only these bit settings are significant. The three middle bits contain right button data, and the three highest-order bits contain data for the middle button, if any.
Each bit within a three-bit segment can be set as follows, from lowest- to highest-order bit:
For example, the bit settings returned for a just-initiated point and click operation—left button is down and just pressed—can be represented as follows:
A click and drag operation that is in progress—right button is down—can be represented like this:
Only four combinations of bit settings are meaningful to Panther and recognized as valid button states:
/*find out whether any button is down */
retval = -1;
if (sm_ms_inquire(MOUSE_BUTTONS) > -1)
return retval & 0x49;