BBS: Inland Empire Archive Date: 11-01-92 (13:30) Number: 353 From: HARRY GISH Refer#: NONE To: KENNY BINGHAM Recvd: NO Subj: Mouse Cursor Conf: (2) Quik_Bas
KB> with one exception.... I need to find a way now to
KB> tell it that if the mouse cursor is in a certain
KB> postition and the mouse button has been clicked
KB> to execute a certain function. Where I am right
KB> now,if I postion the pointer there,it executes or
KB> I can push the button and it executes.... Which
KB> would be fine if I can figure a way to tell it to
KB> do either this or that when the button is pushed.
KB> You mentioned 5 different modes for the cursor?
KB> Can I see some codes for them?
Sure, but of course they only work in ZBasic :-}.
MouseStatus = MOUSE(0)
"initializes mouse, if present, and returns -1 if so"
LONG IF MouseStatus
PRINT "Mouse X Location is " MOUSE(1)
PRINT "Mouse Y Location is " MOUSE(2)
LONG IF MOUSE(3)>0
IF MOUSE(3)=1 PRINT "Left Button is pressed"
IF MOUSE(3)=2 PRINT "Right Button is pressed"
IF MOUSE(3)=3 PRINT "Both Buttons are pressed"
IF MOUSE(3)=4 PRINT "Middle Button is pressed (and 3 button)"
IF MOUSE(3)=5 PRINT "Left and Middle Buttons are pressed"
...
...
END IF
MOUSE(4)
"The above line displays the mouse cursor"
MOUSE(5)
"Hides the mouse cursor"
FOR X = 0 TO 4
CURSOR X
DELAY 1000
"Note that DELAY in ZB works the same regardless of CPU speed."
"Right, Bill Beeler?"
IF LEN(INKEY$) END
GOTO"initialize mouse, if present, and returns -1 if so"
Oh, yes, a couple of things that might be a bit confusing to QB users:
First, case is sensitive in ZB source code ... that it
VARIABLE and Variable are distinctly different variable
names and second labels in ZB
can be any quoted string. That is you can indeed issue
GOSUB"Do This Silly Subroutine Now". Actually a better self-
documenting concept than REM's (haven't written a REM line
in years!!!).
--- Maximus/2 2.01wb
* Origin: ACCESS BBS (1:124/2122)

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