FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Programs
(Moderators: fry, REAS)
   Mouse Button Events
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: Mouse Button Events  (Read 1576 times)
firdosh


Mouse Button Events
« on: Jun 7th, 2004, 4:48pm »

how do i know whay button the user pressed on the mouse. Left / right / middle click??
 
marcello

WWW Email
Re: Mouse Button Events
« Reply #1 on: Jun 8th, 2004, 4:14pm »

Hi,
Here is a very simple code Iíve extracted from the TechNotes section of this web site:
 
http://processing.org/reference/technotes/index.html
 
There Iíve found many answers to my questions (thanks to all contributors)
 
Code:

void loop() {
}
 
void mousePressed() {  
  if ( (mouseEvent.getModifiers() & InputEvent.BUTTON1_MASK ) !=0) {  
    println('1');
  }  
  else if ( (mouseEvent.getModifiers() & InputEvent.BUTTON2_MASK) != 0) {  
    println('2');
  }  
  else if ( (mouseEvent.getModifiers() & InputEvent.BUTTON3_MASK) != 0) {  
    println('3');
  }  
}  
 
Flux
Guest
Email
Re: Mouse Button Events
« Reply #2 on: Jun 9th, 2004, 9:42pm »

heya. does this technique work with exported applets as well?
 
kevinP

Email
Re: Mouse Button Events
« Reply #3 on: Jun 9th, 2004, 10:07pm »

on Jun 9th, 2004, 9:42pm, Flux wrote:
heya. does this technique work with exported applets as well

 
http://www.tiros.net/pfeiffer/processing/misc/which_button/
 

Kevin Pfeiffer
Pages: 1 

« Previous topic | Next topic »