Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Help needed clearing Mouse Buffer to prevent double presses

Author
Message
DemonHill
18
Years of Service
User Offline
Joined: 20th Mar 2008
Location:
Posted: 6th Apr 2008 21:59
Hi,

I have a simple programme but the mouse keys are remmbered and I guess store multiple mouse presses..

button7=11
if mousex()>=u+600 and mousex()<=u+700 and mousey()>=v and mousey()<=v+26
button7=21
endif
paste image button7,600,705

if mousex()>=u+600 and mousex()<=u+700 and mousey()>=v and mousey()<=v+26
ink rgb(500,500,500),1
if mouseclick()=1
d=1
text 200,500,"Next Session"
Session=3
Gosub NextSession
endif
else
endif



Any ideas how to clear the mouse buffer after it selects an option ?
LBFN
19
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 6th Apr 2008 22:58
I don't know of any mouse buffer. If you want to avoid the user double-clicking something, just use a variable to control it. Assuming you set letgo = 0 initially:


Your code would be easier to read and debug if you indent it.

LBFN
Libervurto
20
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 6th Apr 2008 23:01 Edited at: 6th Apr 2008 23:03
errr... how many buttons does you mouse have?!
the mouse returns the stat of each button as a single integer: lmb has a value of 1, rmb has a value of 2 and cmb (wheel button) has a value of 4.
These values are added together to give the mouseclick().
so just pressing lmb returns 1, pressing lmb and cmb returns 5, etc.

crap! just realised you weren't asking that.

to stop db registering multiple clicks you need a variable that cancels out the mouseclick() after the first click.
I think this is known as a flip-flop switch in electronics.


that is so annoying.
i really should buy a keyboard

Login to post a reply

Server time is: 2026-07-06 05:34:54
Your offset time is: 2026-07-06 05:34:54