Viewing contents of file '../idllib/contrib/tappin/graffer/gr_overwrt.pro'
;+
; GR_OVERWRT
; Do you want to overwrite an existing file?
;
; Usage:
; gr_overwrt, pdefs
;
; Argument
; pdefs struct input The graffer structure, needed if save
; requested.
;
; Keyword:
; default int input Which button to give the focus: 0 -
; no, 1 - yes
;
; History:
; Original (from GRAFF_S_PROMPT): 5/11/96; SJT
; Shorten name: 25/11/96; SJT
; Add options for binary or ascii save: 15/1/97; SJT
;-
function Gr_overwrt, parent, default=default
widget_control, parent, sensitive = 0
base = widget_base(/column, title = 'Graffer overwrt?', $
group_leader = parent, resource = $
'Graffer')
msg = [' File already exists ', $
'Do you want to overwrite it?']
junk = widget_text(base, value = msg, xsize = max(strlen(msg)), ysize $
= n_elements(msg))
opts = [' NO ', $
' YES ']
vals = [0, 1]
junk = cw_bgroup(base, opts, /row, button_uvalue = vals, ids = bids)
; RYO widget management to allow us to get the values back from
; the event handler without using a common block, even after the
; hierarchy has been destroyed.
widget_control, base, /real
if (n_elements(default) ne 0) then $
widget_control, bids(default), /input
ev = widget_event(base)
widget_control, base, /destroy
widget_control, parent, sensitive = 1
return, ev.value
end