;+ ; GRAFF_DSDEL ; Delete the current data set. ; ; Usage: ; graff_dsdel, pdefs ; ; Argument ; pdefs struct input The graffer structure, needed if save ; requested. ; ; History: ; Original: 29/8/95; SJT ;- pro Graff_dsdel, pdefs widget_control, pdefs.ids.graffer, sensitive = 0 handle_value, pdefs.data, data, /no_copy cdesc = data(pdefs.cset).descript handle_value, pdefs.data, data, /no_copy, /set base = widget_base(/column, title = 'Graffer delete?', $ group_leader = pdefs.ids.graffer) if (pdefs.nsets gt 1) then begin msg = ['Do you really want to', $ 'delete the current', $ 'data set containing', $ cdesc+'?'] opts = ['CANCEL', 'DELETE'] vals = [0, 1] endif else begin msg = ["Can't delete the only", $ "data set present"] opts = ['Acknowledge'] vals = [0] endelse junk = widget_text(base, value = msg, xsize = max(strlen(msg)), ysize $ = n_elements(msg)) 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 widget_control, bids(0), /input ev = widget_event(base) widget_control, base, /destroy widget_control, pdefs.ids.graffer, sensitive = 1 if (ev.value eq 0) then return ; Don't delete the ds. handle_value, pdefs.data, data, /no_copy if (pdefs.cset eq 0) then begin data = data(1:*) endif else if (pdefs.cset eq pdefs.nsets-1) then begin data = data(0:pdefs.cset-1) endif else begin data = [data(0:Pdefs.cset-1), data(Pdefs.cset+1:*)] endelse handle_value, pdefs.data, data, /no_copy, /set pdefs.nsets = pdefs.nsets-1 pdefs.cset = pdefs.cset < (pdefs.nsets-1) widget_control, pdefs.ids.cset, set_value = pdefs.cset graff_set_vals, pdefs, /set_only end