Re: Cursor problem when switching windows [message #79619] |
Mon, 19 March 2012 12:20  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
dshadovi writes:
> I am haing a problem with CURSOR. When I plot something in a window,
> plot something in another window, and then attempt to get the value of
> a point in the first window, I get the value of the corresponding
> point in the second window. Is there a way to recover values from the
> first window without replotting?
The Cursor command needs information stored in the
system variables !P, !X, !Y and (possibly) !Z and
(maybe) !Map. These all get set when you do a
graphics plots of some sort. And, they are
reset by your plot in the second window, which
is why you are experiencing this problem.
If you want to go back to window 1, for example,
without recreating the graphics command again,
you will have to restore the system variables from
that window in order to get the proper values.
This assumes, of course, that you have saved them
at some point.
You can see this technique here, since the same problem
often occurs when doing multiple plots:
http://www.idlcoyote.com/tips/oplot_pmulti.html
This is naturally a lot of work with regular graphics
windows and the CURSOR command, so most of the time
you would probably build some kind of "window object"
of the cgWindow sort, that stores this information
internally and can recall it whenever needed.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
|