;-------------------------------------------------------------------------
; Procedure testplot_event
; Event handler for testplot
;-------------------------------------------------------------------------
; The event handler is used to handle the event of a user clicking
on the
; exit button (the button is a widget) in the window of the plot
PRO testplot_event, event
; Get the user value of the widget that generated the event.
widget_control, event.id, get_uvalue=uvalue
; Handle events.
case uvalue of
'exit' : begin
widget_control, event.top, /destroy
end
default: begin
print, 'Event received, no action:'
help, event, /struct
end
endcase
END
;-------------------------------------------------------------------------
; Procedure align
; This procedure plots 5 functions on the same set of axes.
;
; Input Arguments:
; xp Vector of independent values
; y1 Vector of first set of dependent values.
; y2 Vector of second set of dependent values.
; y3 Vector of third set of dependent values.
; y4 Vector of fourth set of dependent values.
; y5 Vector of fifth set of dependent values.
;
; The input Keywords coincide with those passed to the PLOT procedure
; and the WIDGET_DRAW procedure.
;-------------------------------------------------------------------------
PRO align, xp, y1, y2, y3, y4, y5,$
xtitle=xtitle, xstyle=xstyle, xticks=xticks,
xminor=xminor,$
xrange=xrange, xsize=xsize,$
ytitle=ytitle, ystyle=ystyle, yticks=yticks,
yminor=yminor,$
yrange=yrange, ysize=ysize,$
charsize=charsize, psym=psym, title=title
;-------------------------------------------------------------------------
; The purpose of the widget is to force the graph to display on
the monitor
; until the user is done viewing the graph. Without the widget,
the program
; automatically returns back to Fortran and destroys the graph
in microseconds.
; Define the Top Level Base widget.
tlb = widget_base( title=title, /column )
; Define an Exit button.
b = widget_button( tlb, value='Exit', uvalue='exit' )
; Define a Draw widget.
d = widget_draw( tlb, xsize=xsize, ysize=ysize )
widget_control, tlb, /realize
; Get the window number of the draw widget.
widget_control, d, get_value=winnum
; Set the Draw widget as the current graphics window.
wset, winnum
; Plot the first function graph.
plot, xp, y1,$
xtitle=xtitle, xstyle=xstyle,
xticks=xticks, xminor=xminor,$
xrange=xrange,$
ytitle=ytitle, ystyle=ystyle,
yticks=yticks, yminor=yminor,$
yrange=yrange,$
charsize=charsize, psym=psym,
title=title
; Overplot the remaining four functions.
oplot, xp, y2
oplot, xp, y3
oplot, xp, y4
oplot, xp, y5
; Enter the Xmanager procedure, so that events can be managed.
xmanager, 'testplot', tlb
END