Page 1 of 1

Guess who's back

Posted: Wed Sep 30, 2009 2:05 pm
by izidor
I'm back with my questions :D

Here is my (QB64) problem, obviously i want to create a box by clicking LMB. Can anyone help? And to Pete in the future is there going to be "QB64 Questions & Answers" forum or sub-forum or how the heck is that called?

Code: Select all

SCREEN 9
_MOUSESHOW
DO
DO
LOOP WHILE _MOUSEINPUT
click = 0
IF _MOUSEBUTTON(1) and click = 0 then
click = click + 1
x = _MOUSEY
y = __MOUSEX

ELSEIF _MOUSEBUTTON(1) and click = 1 then
LINE (x,y)-(__MOUSEX,_MOUSEY),1,B
click = 0
END IF
LOOP



Posted: Wed Sep 30, 2009 3:02 pm
by burger2227
You are not using _MOUSEINPUT correctly! It is used to find out if new data is available so all of your _MOUSEBUTTON reads need to be inside of that loop.

Code: Select all


DO 'main program loop

DO WHILE _MOUSEINPUT ' only loops when mouse has new info

' any mouse function reads go here

LOOP

LOOP UNTIL INKEY$ = CHR$(27)

_MOUSEINPUT makes sure that the program does not miss any new mouse information.

If Pete plans on making a Forum for QB64, he will have to do something about that M O U S E X function. Wonder why it keeps the _MOUSEX part?

Posted: Fri Oct 02, 2009 1:52 pm
by izidor
Ok but that doesn't solve the problem.

Posted: Fri Oct 02, 2009 3:43 pm
by burger2227
Your CLICK variable will always be 0 because it is constantly reset to 0 every loop, but your second alternative already does that after the second click and click = 1. Take that line before the IF statement out. Even if you leave the loop because of mouse inactivity.

BTW I will not answer any more of your questions if you continue to wait days to reply or just get what you want and do not reply! This has happened WAY TOO OFTEN!