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.

Dark GDK / Mouse Click Problem

Author
Message
bla
15
Years of Service
User Offline
Joined: 21st Feb 2009
Location:
Posted: 24th Feb 2009 17:59 Edited at: 24th Feb 2009 18:42
hi..
i know when dbMouseClick() == 1
means mouse left button
and when dbMouseClick() == 2
means mouse right button

but.. if i want to check for both of them?
something will happen only when left button and right button are pressed..
and its cannot be possible.. becoz when dbMouseClick() = 1 he is not = 2 :S what to do?
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 24th Feb 2009 22:18
i guess you could check if one button was pressed, and then check if the other button was pressed and if the other button wasn't pressed in a certain amount of time then restart the process. Kinda lengthy though.
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 24th Feb 2009 23:39
Check for a return value of 3. Essentially the value returned represents a bit value of up to four buttons that an be pressed.

Button 1 = 1
Button 2 = 2
Button 3 = 4
Button 4 = 8

All of these are additive without stepping on the values from the other buttons. If buttons 1 and 3 were pressed it would return 1 + 4 = 5. If buttons 3 and 4 were pressed it would return 4 + 8 = 12.

The problem is if you're looking for button 1 being pressed and the user is pressing 1 and 2. You have to take the returned value ANDed by a bit mask to check for a specific button.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 24th Feb 2009 23:52
What I do is have something like this:



That way I can just use 'if ( dbMouseClick( ) == MOUSE_LEFT + MOUSE_RIGHT )' to check if both buttons are held.

Oh, and as Lilith said, if you want to check if a certain button is held down regardless of what other buttons are being held as well you'd have to use 'if ( dbMouseClick( ) & MOUSE_LEFT/RIGHT/MIDDLE )', depending on which you're checking for.

Login to post a reply

Server time is: 2024-09-30 19:29:36
Your offset time is: 2024-09-30 19:29:36