comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: draw window mouse events
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: draw window mouse events [message #19910] Fri, 28 April 2000 00:00
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
"Rick Towler" <rtowler@u.washington.edu> wrote in message
news:39087CCA.263A52DC@u.washington.edu...
> I have been trying to implement middle and third button events in my
> draw widget in much the same way as in the IDL demo d_objworld2.pro. I
> have not found it easy to understand how everything happens in this demo
> program.
>
> I am interested in getting one of these buttons to utilize the TRANSLATE
> feature of the trackball object so I can translate my models. I did
> have the left button transforming the model but I have broken that in my
> quest to understand this whole process which obviously I don't since I
> can't get it working again.
> ...
> Hints and/or pointers to examples that are a wee bit simpler than
> d_objworld2 are much appreciated.

Well if you like you can look at my MGHgrWindow class:

http://katipo.niwa.cri.nz/~hadfield/gust/software/idl/mghgrw indow__define.pr
o

It calls a number of other routines, all of which you can find in

http://katipo.niwa.cri.nz/~hadfield/gust/software/idl/MARKS_ ROUTINES.tar.gz

MGHgrWindow provides for a range of manipulations with the mouse (rotate,
translate, scale). In particular see methods EventTrack, EventScale and
EventTranslate. But I don't guarantee that its code is any simpler or easier
to understand than the IDL demo.

Looking through the code again, I note that I have used the Trackball object
for rotation only. Scaling and translation are done through calls to the
model's Translate and Scale methods. The basic logic for handling mouse
events is pretty simple:

Press events
Reduce window's QUALITY for faster redraws
Store event.x and event.y (say as x0, y0)

Motion events
Scale/translate according to values of [event.x-x0, event.y-y0]
Set x0 = event.x, y0 = event.y
Draw

Release events
Restore window quality
Draw
Forget x0 & y0

Hope this helps

---
Mark Hadfield
m.hadfield@niwa.cri.nz http://katipo.niwa.cri.nz/~hadfield/
National Institute for Water and Atmospheric Research
PO Box 14-901, Wellington, New Zealand
Re: draw window mouse events [message #19914 is a reply to message #19910] Thu, 27 April 2000 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Rick Towler (rtowler@u.washington.edu) writes:

> I have been trying to implement middle and third button events in my
> draw widget in much the same way as in the IDL demo d_objworld2.pro. I
> have not found it easy to understand how everything happens in this demo
> program.
>
> I am interested in getting one of these buttons to utilize the TRANSLATE
> feature of the trackball object so I can translate my models. I did
> have the left button transforming the model but I have broken that in my
> quest to understand this whole process which obviously I don't since I
> can't get it working again.
>
> I have the events getting into the correct handling loops. That is,
> clicks and motion trigger print statements in my loops, but I cant seem
> to get the updates from the trackball object. Every call to
> oTrack->update returns EQ 0.
>
> Hints and/or pointers to examples that are a wee bit simpler than
> d_objworld2 are much appreciated.

The problem here is this:

> 'MOTION': BEGIN
> print,'Motion with btndown='+string(state.btndown)
> IF (state.btndown) AND (bHaveTransform) THEN $
> state.oDWindow->Draw,state.oView
> END

You are not *doing* anything with motion events except
displaying the same view over and over again. Pretty
dull.

What you need here is a CASE statement that allows
you to rotate with the LEFT button, translate with
the RIGHT, etc.

I'm not feeling well enough to write an example today,
and looking at RSI code even when I feel well is almost
too much, but I'm guessing if you go look at that
d_objworld2 example you will find a LOT more code
in the MOTION section. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: VB and IDL
Next Topic: HOW TO TURN SIX DOLLARS INTO SIX THOUSAND DOLLARS!!

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 07:17:26 PDT 2025

Total time taken to generate the page: 1.20440 seconds