12-11-2022, 07:59 AM
I am running this program to play with the mouse, just playing with things to understand it before trying to imbed it into something else.
and it is working as expected with a box highlighting and not but I don't understand why this if statement needs EQV:
than the one I was trying to work with at first:
My belief that If (false and True or True or True or True) should return a false with false and true.... condition.
Never used EQV before but the table on the wiki implies both should return false. Maybe someone can educate me where my logic has gone wrong? Many thanks
Code: (Select All)
$NOPREFIX
CONST FALSE = 0, TRUE = NOT FALSE
TYPE MouseType
EndX AS INTEGER
EndY AS INTEGER
StartX AS INTEGER
StartY AS INTEGER
LButDown AS INTEGER
RButDown AS INTEGER
OldLBut AS INTEGER
OldRBut AS INTEGER
END TYPE
SCREEN NEWIMAGE(1280, 720, 32)
DIM AS MouseType Mouse
DIM AS INTEGER highlight(500000)
DIM AS BIT Active
Mouse.OldLBut = --1
Active = FALSE
LINE (500, 200)-(600, 300), RGB(0, 0, 255), BF
DO
'LIMIT 120
DO WHILE MOUSEINPUT
LOOP
Mouse.StartX = MOUSEX
Mouse.StartY = MOUSEY
Mouse.LButDown = MOUSEBUTTON(1)
IF Mouse.StartX >= 500 AND Mouse.StartX <= 600 AND Mouse.StartY >= 200 AND Mouse.StartY <= 300 AND NOT Active THEN
GET (500, 200)-(600, 300), highlight()
PUT (500, 200), highlight(), PRESET
Active = TRUE
ELSEIF Active EQV Mouse.StartX < 500 OR Mouse.StartX > 600 OR Mouse.StartY < 200 OR Mouse.StartY > 300 THEN
GET (500, 200)-(600, 300), highlight()
PUT (500, 200), highlight(), PRESET
Active = FALSE
END IF
IF Mouse.LButDown AND NOT Mouse.OldLBut THEN
LOCATE 1, 1
PRINT Mouse.StartX, Mouse.StartY, Mouse.LButDown
END IF
Mouse.OldLBut = Mouse.LButDown
LOOP UNTIL INKEY$ = CHR$(27)
and it is working as expected with a box highlighting and not but I don't understand why this if statement needs EQV:
Code: (Select All)
ELSEIF Active EQV Mouse.StartX < 500 OR Mouse.StartX > 600 OR Mouse.StartY < 200 OR Mouse.StartY > 300 THEN
GET (500, 200)-(600, 300), highlight()
PUT (500, 200), highlight(), PRESET
Active = FALSE
END IF
than the one I was trying to work with at first:
Code: (Select All)
ELSEIF Active AND Mouse.StartX < 500 OR Mouse.StartX > 600 OR Mouse.StartY < 200 OR Mouse.StartY > 300 THEN
GET (500, 200)-(600, 300), highlight()
PUT (500, 200), highlight(), PRESET
Active = FALSE
END IF
My belief that If (false and True or True or True or True) should return a false with false and true.... condition.
Never used EQV before but the table on the wiki implies both should return false. Maybe someone can educate me where my logic has gone wrong? Many thanks