[Gambas-user] Mouse position on a drawing area

ron ronstk at ...239...
Mon Apr 19 13:34:45 CEST 2004


On Monday 19 April 2004 11:07, John Bartlett wrote:
> Hi,
>
> I am  stuck!
>
> I am trying to retrieve information as to the position of the mouse over
> a drawing area.  I have tried the MouseDown (X as Integer, Y as Integer,
> B as Button) event but each time I try to instantiate a new form, the
> error message reports "Bad Event handler in
> Fgraph.DrawingArea1_MouseDown(): Too many arguments.".  The same applies
> if I try MouseMove.
>
> I am using Gambas 0.91 on Suse Linux 9.0 with KDE 3.1 and QT 3.21-56.
>
> Am I doing anything wrong?
>
> Thanks
>
> John Bartlett



As of version .90 and higher the arguments in the events are
almost moved to there origin objects.
In you request it is the mouse
Use gb.qt.Mouse to see what is available and
use gb.qt.Key for the keyboard

Do not forget to set  DrawingArea1.Tracking=TRUE
else it will not work

This code snipped works here.

' should be done in property sheet  or the initialize routine.of the form
PUBLIC SUB DrawingArea1_KeyPress()
  DrawingArea1.Tracking = TRUE
END

' this shows the mouse position in the area
PUBLIC SUB DrawingArea1_MouseMove()
  TextBox1.Text = Mouse.X
  TextBox2.Text = Mouse.Y
END





More information about the User mailing list