We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
mouseButton (Read 683 times)
mouseButton
May 5th, 2007, 10:08pm
 
Hi,

Standard behaviour in Java is for the right mouse button to correspond to the left button plus the 'Meta' key (the Apple key on Apples, I'm led to understand), making it inoffensive to use right-clicking/dragging as a basic form of user interaction; it's a bit of an odd way to do it, but it does have the huge advantage that you can use both buttons without excluding vast swathes of users.

However, my Processing applets don't seem to respond to any combination of holding down a key and pressing the mouse button as if it were a right-click! What's that about? Should I submit this as a bug report? Or am I missing something?

Cheers!
Re: mouseButton
Reply #1 - May 5th, 2007, 10:52pm
 
In processing the right mouse button, is the right mouse button nothing else.

There's nothing to stop you making your program interpret left+key the same as a right mouse button.
Re: mouseButton
Reply #2 - May 5th, 2007, 11:04pm
 
I think this is the code about what you have meant :
(this code, if running on OS X is equal to the right mouse button pressed)
Quote:
void setup(){
size(400, 400);
background(0);
}

void draw(){
if(mousePressed == true && mouseButton == LEFT){
   if(keyPressed == true && keyCode == CONTROL){
         ellipse(mouseX, mouseY,20,20);}
     }
   }
Re: mouseButton
Reply #3 - May 5th, 2007, 11:09pm
 
If you only want to use the Right mouse button :

Quote:
void setup(){
size(400, 400);
background(0);
}

void draw(){
if(mousePressed == true && mouseButton == RIGHT){
         ellipse(mouseX, mouseY,20,20);}
     }
Page Index Toggle Pages: 1