[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: draw window mouse events



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