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

Home » Public Forums » archive » Re: IDL 8 NG widget problem
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: IDL 8 NG widget problem [message #74714] Tue, 01 February 2011 09:03 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> Then, if you want to "erase" the first plot, you
> just type:
>
> FSC_Erase, Layout=[2,2,1]
>
> I'll check this in later today with the other changes. :-)

The program is available here:

http://www.idlcoyote.com/programs/fsc_erase.pro

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.")
Re: IDL 8 NG widget problem [message #74717 is a reply to message #74714] Tue, 01 February 2011 08:46 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
caroline cox writes:

> thanks, but I am not sure that will help. I have shown a simplified
> version of my program here. I actually call other functions from the
> menu buttons and I guess I want the function to make sure that if
> there is something already plotted in the widget space then it clears
> it and starts a fresh plot. I use widget_control, draw, get_value=win
> then win.select to plot in the current window. Is there anything that
> I can use here to clear the current plot? I have tried win.refresh.

I can't help you with IDL 8 function graphics, sorry.
I'll get around to fixing those in my next book. ;-)

But this is a pretty neat idea, so I just modified
FSC_Erase to have a Layout keyword like other Coyote
Graphics routines. This allows you to "erase" just
a portion of the display.

So, you can do this, for example.

FSC_Plot, LoadData(17), Layout=[2,2,1]
FSC_Plot, LoadData(17), Layout=[2,2,4]

Then, if you want to "erase" the first plot, you
just type:

FSC_Erase, Layout=[2,2,1]

I'll check this in later today with the other changes. :-)

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.")
Re: IDL 8 NG widget problem [message #74718 is a reply to message #74717] Tue, 01 February 2011 08:22 Go to previous messageGo to next message
caroline cox is currently offline  caroline cox
Messages: 1
Registered: February 2011
Junior Member
On Feb 1, 1:48 pm, Gray <grayliketheco...@gmail.com> wrote:
> On Feb 1, 7:02 am, vanessa_c <cjncvc2...@gmail.com> wrote:
>
>
>
>
>
>> I am trying to create a widget using the new IDL 8 plot function and
>> widget_window.  I'd like to be able to display different plots in the
>> widget window and each time I choose a different menu button, have a
>> fresh plot appear.   I am using /current to make each plot appear in
>> the same widget window.  However, I'm having trouble with the plots
>> simply being plotted over each other within the graphics window. I've
>> played around with using /overplot but I don't think it helps because
>> I need to have multiple plots on the screen.  There isnt this problem
>> when I use the old graphics (widget_draw), with the code not very
>> different to the one I am using now.  Perhaps I am missing something
>> that clears the current plot?
>
>> Thanks.
>
>> PRO
>> barebones_event, ev
>> WIDGET_CONTROL, ev.id, GET_UVALUE = uval
>> WIDGET_CONTROL, ev.top, GET_UVALUE = state
>> case uval of
>> 'menu1': BEGIN
>> ; Retrieve the newly-created Window object.
>> WIDGET_CONTROL
>> , state.Draw, GET_VALUE = graphicWin
>> ; Make sure this is the current window
>> graphicWin.
>> SELECT
>> p=
>> plot([0,10],[5,5],title='plot1',/current,yrange=[0,6],layout =[2,2,1])
>> p=
>> plot([0,10],[5,5],title='plot1',/current,yrange=[0,6],layout =[2,2,4])
>> END
>> 'menu2': BEGIN
>> WIDGET_CONTROL
>> , state.Draw, GET_VALUE = graphicWin
>> ; Make sure this is the current window
>> graphicWin.
>> SELECT
>> p2=
>> plot([0,10],[15,15],title='plot2',/
>> current,yrange=[0,20],layout=[2,2,2])
>> p2=
>> plot([0,10],[15,15],title='plot2',/
>> current,yrange=[0,6],layout=[2,2,4])
>> END
>> ;buttons
>> 'Cancel': WIDGET_CONTROL, ev.top, /DESTROY
>
>> ELSE :
>> ENDCASE
>> WIDGET_CONTROL, state.base, SET_UVALUE = state
>> END
>
>> PRO
>> barebones
>> ; menu bar widget
>> base =
>> WIDGET_BASE(MBAR=bar, TITLE='test', row = 1)
>> menu1 =
>> WIDGET_BUTTON(bar, VALUE='menu', UVALUE='menu', /MENU)
>> men1but1 =
>> WIDGET_BUTTON(menu1, VALUE='menu1', UVALUE='menu1')
>> men1but2 =
>> WIDGET_BUTTON(menu1, VALUE='menu2', UVALUE='menu2')
>> draw = WIDGET_WINDOW(base, UVALUE='draw', UNAME='DRAW')
>> bbase =
>> WIDGET_BASE(base, column = 1, frame =1, title = 'OPTIONS')
>> bsize =
>> 75
>> buttb =
>> widget_button(bbase, value = 'Cancel', uvalue = 'Cancel', $
>> xsize = bsize, /align_center, yoffset =
>> 30)
>
>> DEVICE, decomposed=0
>> state = { base:base, $
>> draw:draw $
>
>> }
>
>> WIDGET_CONTROL, base, SET_UVALUE = state
>> WIDGET_CONTROL, base, /REALIZE
>> XMANAGER, 'barebones', base
>> END
>
> I think what you want is the p.hide property.- Hide quoted text -
>
> - Show quoted text -

thanks, but I am not sure that will help. I have shown a simplified
version of my program here. I actually call other functions from the
menu buttons and I guess I want the function to make sure that if
there is something already plotted in the widget space then it clears
it and starts a fresh plot. I use widget_control, draw, get_value=win
then win.select to plot in the current window. Is there anything that
I can use here to clear the current plot? I have tried win.refresh.
Re: IDL 8 NG widget problem [message #74726 is a reply to message #74718] Tue, 01 February 2011 05:48 Go to previous messageGo to next message
Gray is currently offline  Gray
Messages: 253
Registered: February 2010
Senior Member
On Feb 1, 7:02 am, vanessa_c <cjncvc2...@gmail.com> wrote:
> I am trying to create a widget using the new IDL 8 plot function and
> widget_window.  I'd like to be able to display different plots in the
> widget window and each time I choose a different menu button, have a
> fresh plot appear.   I am using /current to make each plot appear in
> the same widget window.  However, I'm having trouble with the plots
> simply being plotted over each other within the graphics window. I've
> played around with using /overplot but I don't think it helps because
> I need to have multiple plots on the screen.  There isnt this problem
> when I use the old graphics (widget_draw), with the code not very
> different to the one I am using now.  Perhaps I am missing something
> that clears the current plot?
>
> Thanks.
>
> PRO
> barebones_event, ev
> WIDGET_CONTROL, ev.id, GET_UVALUE = uval
> WIDGET_CONTROL, ev.top, GET_UVALUE = state
> case uval of
> 'menu1': BEGIN
> ; Retrieve the newly-created Window object.
> WIDGET_CONTROL
> , state.Draw, GET_VALUE = graphicWin
> ; Make sure this is the current window
> graphicWin.
> SELECT
> p=
> plot([0,10],[5,5],title='plot1',/current,yrange=[0,6],layout =[2,2,1])
> p=
> plot([0,10],[5,5],title='plot1',/current,yrange=[0,6],layout =[2,2,4])
> END
> 'menu2': BEGIN
> WIDGET_CONTROL
> , state.Draw, GET_VALUE = graphicWin
> ; Make sure this is the current window
> graphicWin.
> SELECT
> p2=
> plot([0,10],[15,15],title='plot2',/
> current,yrange=[0,20],layout=[2,2,2])
> p2=
> plot([0,10],[15,15],title='plot2',/
> current,yrange=[0,6],layout=[2,2,4])
> END
> ;buttons
> 'Cancel': WIDGET_CONTROL, ev.top, /DESTROY
>
> ELSE :
> ENDCASE
> WIDGET_CONTROL, state.base, SET_UVALUE = state
> END
>
> PRO
> barebones
> ; menu bar widget
> base =
> WIDGET_BASE(MBAR=bar, TITLE='test', row = 1)
> menu1 =
> WIDGET_BUTTON(bar, VALUE='menu', UVALUE='menu', /MENU)
> men1but1 =
> WIDGET_BUTTON(menu1, VALUE='menu1', UVALUE='menu1')
> men1but2 =
> WIDGET_BUTTON(menu1, VALUE='menu2', UVALUE='menu2')
> draw = WIDGET_WINDOW(base, UVALUE='draw', UNAME='DRAW')
> bbase =
> WIDGET_BASE(base, column = 1, frame =1, title = 'OPTIONS')
> bsize =
> 75
> buttb =
> widget_button(bbase, value = 'Cancel', uvalue = 'Cancel', $
> xsize = bsize, /align_center, yoffset =
> 30)
>
> DEVICE, decomposed=0
> state = { base:base, $
> draw:draw $
>
> }
>
> WIDGET_CONTROL, base, SET_UVALUE = state
> WIDGET_CONTROL, base, /REALIZE
> XMANAGER, 'barebones', base
> END

I think what you want is the p.hide property.
Re: IDL 8 NG widget problem [message #74801 is a reply to message #74718] Tue, 01 February 2011 16:18 Go to previous message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
On Feb 1, 9:22 am, caroline cox <caroline.co...@gmail.com> wrote:
>
> thanks, but I am not sure that will help.  I have shown a simplified
> version of my program here.  I actually call other functions from the
> menu buttons and I guess I want the function to make sure that if
> there is something already plotted in the widget space then it clears
> it and starts a fresh plot.  I use widget_control, draw, get_value=win
> then win.select to plot in the current window.  Is there anything that
> I can use here to clear the current plot?  I have tried win.refresh.

Hi,

In IDL 8.1 we are adding a "Delete" method to the new graphics - it
will delete just that graphic. We are also adding a GetData/SetData
method, so you can change the data on an existing graphic (like a
Plot) and all of the properties will stay the same.

For now, in IDL 8.0, you can use the undocumented "PutData" method:
p = plot(/test)
p.PutData, findgen(2,100)
The first column is the X values, and the second is the Y values.

Hope this helps!

-Chris
ITTVIS
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Library/Functions to write configuration file for application
Next Topic: Re: Contour Plot w/ Colorbar

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

Current Time: Wed Oct 08 11:44:02 PDT 2025

Total time taken to generate the page: 0.00669 seconds