David Fanning's rubberband box [message #11108] |
Thu, 12 March 1998 00:00  |
nospam
Messages: 21 Registered: November 1997
|
Junior Member |
|
|
I've recently gotten David Fanning's book, and I like it quite a bit.
Good job, David! I am having a problem though with the rubberband box
code on page 117. I'm using IDL 5.0.2 on an SGI. When I am finished
drawing the rubberband box and release the mouse button, the program
does not exit the repeat loop. I have to push another button before it
will register that I've released the first button. I added the
following line just before the ENDREP:
cursor, x, y, /NoWait
ENDREP UNITL !Mouse.Button NE 1
That mostly fixed the problem, but it still seems to only work
sporadically. That is, sometimes I'll draw a box, release the button,
and it ends the loop as it is supposed to, other times it does not,
and I have to either redraw the box or push another button. This is a
problem because I was planning to use the other mouse buttons for
other things (middle button to zoom out, right button to exit the
program). This behavior persists when I run the program on the SGI
with the display on the console or on a PC (NT) with X-Win32
Thanks for the help!
scott
--
Scott Stuart
stuart at ll mit edu
|
|
|
Re: David Fanning's rubberband box [message #11279 is a reply to message #11108] |
Mon, 16 March 1998 00:00  |
mallors
Messages: 76 Registered: November 1997
|
Member |
|
|
In article <NOSPAM.98Mar12100832@pickering.ll.mit.edu>,
nospam@ll.mit.edu (Joseph Scott Stuart) writes:
>
> I've recently gotten David Fanning's book, and I like it quite a bit.
> Good job, David! I am having a problem though with the rubberband box
> code on page 117. I'm using IDL 5.0.2 on an SGI. When I am finished
> drawing the rubberband box and release the mouse button, the program
> does not exit the repeat loop. I have to push another button before it
> will register that I've released the first button. I added the
> following line just before the ENDREP:
>
> cursor, x, y, /NoWait
> ENDREP UNITL !Mouse.Button NE 1
>
> That mostly fixed the problem, but it still seems to only work
> sporadically. That is, sometimes I'll draw a box, release the button,
> and it ends the loop as it is supposed to, other times it does not,
> and I have to either redraw the box or push another button. This is a
> problem because I was planning to use the other mouse buttons for
> other things (middle button to zoom out, right button to exit the
> program). This behavior persists when I run the program on the SGI
> with the display on the console or on a PC (NT) with X-Win32
>
I have a selection routine TRACK_MOUSE that will work in a WIDGET_DRAW,
allowing rubber band selections of arbitrary regions (or you can select
individual intervals, too). The code got a bit out of hand when I was
writing it, but it does have comments :-) You can take a look at it on
my web page:
http://cspar.uah.edu/~mallozzir/idl/idl.html
There is an example program there of how to use TRACK_MOUSE.
I also have an older version written by a colleague of mine for direct
graphics windows, which I might dig up if anyone is interested. Since IDL
widgets are so nice and easy, I usually stick to widget code for
interactive-intensive tasks like selecting and zooming plots, and don't
really use the direct graphics version anymore.
If anyone makes changes to the code, I'd appreciate receiving an updated
version.
Regards,
-bob mallozzi
--
Robert S. Mallozzi
http://cspar.uah.edu/~mallozzir/
Remove NOJUNK on reply
|
|
|