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
   Syntax
(Moderators: fry, REAS)
   Other mouse buttons
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: Other mouse buttons  (Read 1167 times)
Jordan J

78870147887014 WWW Email
Other mouse buttons
« on: Mar 18th, 2003, 2:52am »

Is it possible to access mouse buttons other than the first one or are they all the same?  Is it possible to access mouse wheels?  I'm guessing because some people (on macs) might only have one mousebutton and no mousewheels then it would be difficult to do this.  But other than some macs, MOST people have two mouse buttons, so that would be a handy feature.  Thanks.
 
benelek

35160983516098 WWW Email
Re: Other mouse buttons
« Reply #1 on: Mar 25th, 2003, 12:57pm »

posted elsewhere on the board:
 
http://proce55ing.net/discourse/yabb/board_Syntax_action_displa_y_num_1042156938.html
 
i'm not sure about mouse wheels though.
 
fry


WWW
Re: Other mouse buttons
« Reply #2 on: Mar 25th, 2003, 4:11pm »

to get the other mouse buttons, you use the full version of mousePressed, ala java.
Code:
public void mousePressed(MouseEvent e) {
  // if you want to automatically set  
  // mouseX et al, include this line:
  super.mousePressed(e);  
 
  // then do things here with the 'e' object  
  // to get info about buttons, etc
}

but that's just regular java code. i don't have a good example right offhand for how to use it well (google or the java tutorial oughta have something useful).
 
you can also use the 'mouseEvent' that's built into p5, in which case you'd just use:
Code:
void mousePressed() {
  // do things with build in variable
  // 'mouseEvent' the way you would with 'e' above
  // (no need for the 'super' call here)
}

for mouse wheel, that's a little trickier. you have to add a MouseWheelListener (again, more info via google), and it won't work when exported as an applet (since only 1.1 code is meant to work properly in applets).
« Last Edit: Mar 25th, 2003, 4:12pm by fry »  
Pages: 1 

« Previous topic | Next topic »