qck.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
Button and Shift Arguments
                        ◄Example►                ◄Contents►  ◄Index►  ◄Back►
──────────────────────────────────────────────────────────────────────────────
 Button and Shift Arguments
 
 ■ If you need to test for the Button or Shift arguments in a MouseDown,
   MouseUp, or MouseMove event, you can declare constants that define the
   bits within the argument by loading the CONSTANT.BI file into each module
   using the $INCLUDE metacommand.
 
 ■ The mouse button constants have the following values:
 
         Constant            Value
         ════════════        ═══════════════════════════════════════════════
         LEFT_BUTTON         1
         RIGHT_BUTTON        2
         SHIFT_MASK          1
         CTRL_MASK           2
         ALT_MASK            4
 
 ■ The constants act as bit masks you can use to test for any combination
   of buttons without having to figure out the unique bit field value for
   each combination.
 
 ■ You test for a condition by first assigning each result to a temporary
   integer variable and then comparing the Button or Shift arguments to a bit
   mask. Use the AND operator with each argument to test if the condition is
   greater than zero, indicating the key or button is pressed. For example:
 
         LeftDown% = (Button AND Left_BUTTON) > 0
         CtrlDown% = (Shift AND CTRL_MASK) > 0
 
   Then, in a procedure, you can test for any combination of conditions. For
   example:
 
         IF LeftDown% AND CtrlDown% THEN
 
 ■ You can use MouseDown and MouseUp to respond to events caused by pressing
   and releasing mouse buttons.
 
 ■ The Button argument for MouseMove differs from the Button argument used
   for MouseDown and MouseUp. For MouseMove, Button indicates the current
   state of all buttons; a single MouseMove event may indicate that some,
   all, or no buttons are pressed. For MouseDown or MouseUp, Button indicates
   exactly one button per event.
 
 See Also
    ◄Click Event►                      ◄DblClick Event►
    ◄MouseDown Event►                  ◄MouseMove Event►
    ◄MouseUp Event►