Mouse routines

 BBS: Inland Empire Archive
Date: 04-09-92 (14:47)             Number: 49
From: MICHAEL MALLEY               Refer#: NONE
  To: JOHN DEPKO                    Recvd: NO  
Subj: Mouse routines                 Conf: (2) Quik_Bas
JD>    Unfortunately, if you hold the mouse button down for more than a few
JD>milliseconds, the button is "read" over and over again, causing the CASE
JD>to be SELECTed more than once, even though there was only one
JD>button-press.

Hello John!

This is similar to the problem of using the <ALT> key to access menus.
There are two things that you can do, the most inefficient is first.

1.  When the button is pressed, set a flag (i.e. Mouse1% = -1), and
    continuously poll to see when the mouse button is no longer pressed.
    Then act on the coordinates.

2.  When the button is pressed, call a routine that returns when the
    button is released, and act on that information.  Interrupt follows:

    INT 33H Function 6H

    Calling registers
    AX = 6H
    BX = Button
         0 - Left
         1 - Right
         2 - Center if present or Left & Right

    Returning registers
    AX = Button status (see chart below)
    BX = Count of button releases since last call
    CX = Horizontal postion when released
    DX = Vertical position when released

    Mouse button status
    7  6  5  4  3  2  1  - Bits
                      0  - Left button up
                      1  - Left button down
                   0     - Right button up
                   1     - Right button down
                0        - Center button up (both)
                1        - Center button down (both)
    x  x  x  x           - Not used

I hope this is what you had in mind.  Until later!  - Michael

 * SLMR 2.1a * Coffee is my only *real* friend.

--- Maximus 2.01wb
 * Origin: UltraTech - Nashville, TN  (615) 356-0453 {HST} (1:116/30)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET