How to use cgplot insidecgwindow with mouse.button command [message #87529] |
Thu, 13 February 2014 02:25  |
tushar
Messages: 3 Registered: April 2013
|
Junior Member |
|
|
Hello,
I am trying to plot graphs in cgwindow command using cgplot with a loop inside it, its not working fine a black window is coming.
When I am running the loop just with cgplot with mouse.button command its working fine, but when i gave cgwindow in front then its showing everytime different window for each plot.
my commands are
> for i = 0, a-1 do begin
> cgwindow, 'cgplot' , air_m, chn[i,*], color='blue', psym=1, thick=3, title = 'plot', xtitle='air mass', ytitle = 'channels', xrange=[0,10], charsize=1.5
> cursor, x , y , /up
> while (!mouse.button eq 4) do begin
> retall
> endwhile
> endfor
i want to plot inside cgwindow and with mouse click next plot should come in same window.
How to do that please explain.
Thank You.
|
|
|
Re: How to use cgplot insidecgwindow with mouse.button command [message #87530 is a reply to message #87529] |
Thu, 13 February 2014 06:19  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
tushar wankhede writes:
> I am trying to plot graphs in cgwindow command using cgplot with a loop inside it, its not working fine a black window is coming.
>
> When I am running the loop just with cgplot with mouse.button command its working fine, but when i gave cgwindow in front then its showing everytime different window for each plot.
>
> my commands are
>> for i = 0, a-1 do begin
>> cgwindow, 'cgplot' , air_m, chn[i,*], color='blue', psym=1, thick=3, title = 'plot', xtitle='air mass', ytitle = 'channels', xrange=[0,10], charsize=1.5
>
>> cursor, x , y , /up
>> while (!mouse.button eq 4) do begin
>> retall
>> endwhile
>> endfor
>
> i want to plot inside cgwindow and with mouse click next plot should come in same window.
> How to do that please explain.
You are not going to be able to use ancient methods of writing
interactive programs (e.g., while (!mouse.button eq 4) ) with cgWindow,
which is a modern interactive or widget program. If you want ancient,
try cgDisplay instead of cgWindow. cgDisplay is just a smart
Window command of the sort that knows what to do with a Cursor command.
If you want to write real interactive (widget) programs, and you like
the functionality of cgWindow, then you have to realize cgWindow is
simply a wrapper for the underlying object cgCmdWindow. You can easily
write your own wrapper for this object and use all of the "cgWindow"
functionality. cgCmdWindow is already set up to become your "graphics
window" which can accept all kinds of widget events (including button
events of the sort you are wanting to use). You simply write an event
handler and tell cgCmdWindow what it is. The cursor events will go there
and you can do whatever you like with them.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|