[Gambas-user] mouse events
Fabien BODARD
abidoo.too at ...11...
Wed Feb 5 21:02:48 CET 2003
Le Mercredi 5 Février 2003 13:58, Jochen Georges a écrit :
> hello gambasians,
>
> is it possible to get the coordinates of the point where the mouse
> clicks a form (or another widget) ?
>
> thanks for any hint.
>
> beste gruesse
> jochen
>
>
> p.s.:
> in java it could be like this:
>
>
> import java.awt.Graphics;
> import java.awt.Color;
> import java.awt.Event;
>
> public class Spots extends java.applet.Applet{
> final int MAXSPOTS =10;
> int xspots[] = new int[MAXSPOTS];
> int yspots[] = new int[MAXSPOTS];
> int currspots = 0;
>
> public void init(){
> setBackground(Color.orange);
> }//init
>
> public boolean mouseDown(Event e, int x, int y){
> if (currspots < MAXSPOTS){
> addspot(x, y);
> return true;
> }else{
> System.out.println("Too many spots.");
> return false;
> }//if-else
> }//mouseDown
>
> void addspot (int x, int y){
> xspots[currspots] = x;
> yspots[currspots] = y;
> currspots++;
> repaint();
> }//addspot
>
> public void paint(Graphics g){
> g.setColor(Color.blue);
> for (int i = 0; i <currspots; i++){
> g.fillOval(xspots[i] - 10, yspots[i] -10,
> 20, 20);
> }//for
> }//paint
> }//class Spots
>
>
> -------------------------------------------------------
> This SF.NET email is sponsored by:
> SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
> http://www.vasoftware.com
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
Salut Jochen
Use the MouseUp event
It return 3 diferent value
Button
Mouse X
Mouse Y
Fabien
More information about the User
mailing list