Re: reading mouse coordinates when using widgets [message #3315] |
Thu, 15 December 1994 08:19  |
rep2857
Messages: 28 Registered: December 1994
|
Junior Member |
|
|
In article <D0p781.6uA@sci.kun.nl>, Chris Hendriks <chrish@cs.kun.nl> wrote:
>
> I use a drawing widget (wwdraw) and I want to retieve mouse coordinates in
> this drawing window. The procedure CURSOR does not seem to work for widgets.
> I use version 4.0. Any suggestions?
>
> Please reply to venvd@nlr.nl.
>
CC'd to venvd@nlr.nl
I'm a bit new to this, so any refinements to what I did are appreciated.
After creating the WwDrawing widget, you need to add some mouse
handlers. The WtAddHandler function manages this. The following code
statements ought to perform this for you.
@wtxlib ; this loads all of the button masks. You can also just assign
; the three mask names below to the values found in wtxlib.pro
drawwin = WwDrawing(drawwid, win, "drawinit", wsize, dsize, Area=d_area)
status = WtAddHandler(d_area, ButtonPressMask or ButtonMotionMask or $
ButtonReleaseMask, "draw_buttonevent", 0)
in draw_buttonevent you will need the following lines:
pro draw_buttonevent, wid, id, nparams, mask, event
x = event.x
y = event.y
; and likely several other lines for coordinate transformations
end
Mike Schienle Hughes Santa Barbara Research Center
rep2857@sbsun0010.sbrc.hac.com 75 Coromar Drive, M/S B28/87
Voice: (805)562-7466 Fax: (805)562-7881 Goleta, CA 93117
|
|
|