;+ ; GRAFF_CH_DSET ; Change data set ; ; Usage: ; graff_ch_dset, pdefs ; ; Argument: ; pdefs struct in/out The plot definition structure. ; ; History: ; Original (essentially a widget version of graff_dset): 7/9/95; SJT ;- function Grf_ch_event, event base = widget_info(event.top, /child) widget_control, base, get_uvalue = uv, /no_copy widget_control, event.id, get_uvalue = but iexit = 0 case (but) of 'POP': begin widget_control, event.top, /show widget_control, event.id, timer = 2.0 end 'CHOOSE': begin uv.select = event.index iexit = 1 end 'DONT': iexit = -1 end widget_control, base, set_uvalue = uv, /no_copy return, {id:event.handler, top:event.top, handler:event.handler, $ Exit:iexit} end pro Graff_ch_dset, pdefs handle_value, pdefs.data, data, /no_copy tc = ['PF', 'F(Y)', 'F(X)', 'XY', 'XYE', 'XYEE'] dlist = [data.descript, ''] nlist = string(indgen(n_elements(dlist))+1, $ format = "(I3,')')") llist = string([data.ndata, 0], format = "(' <',I0,'> ')") lll = max(strlen(llist)) fmt = "(A"+string(lll, format = "(I0)")+")" llist = string(llist, format = fmt) nlist = nlist+llist nlist = nlist+string([tc(data.type+3), ''], format = "(A4, ' - ')") dlist = nlist+dlist widget_control, pdefs.ids.graffer, sensitive = 0 tlb = widget_base(title = 'Graffer data set select', group = $ pdefs.ids.graffer) base = widget_base(tlb, /column) curr = widget_label(base, value = 'Data Sets', uvalue = 'POP') junk = widget_list(base, value = dlist, uvalue = 'CHOOSE', $ ysize = (12 < n_elements(dlist))) junk = widget_button(base, value = 'Cancel', uvalue = 'DONT') ;;junk = cw_bgroup(base, ['Done', 'Cancel'], uvalue = 'ACTION', $ ;; button_uvalue = ['DO', 'DONT'], /row) widget_control, base, set_uvalue = {dlist:dlist, $ Select:pdefs.cset}, $ event_func = 'grf_ch_event' widget_control, tlb, /real widget_control, curr, timer = 2. ; DIY widget management here repeat ev = widget_event(base) until ev.exit ne 0 widget_control, base, get_uvalue = uv, /no_copy widget_control, tlb, /destroy widget_control, pdefs.ids.graffer, sensitive = 1 if (ev.exit eq -1) then begin handle_value, pdefs.data, data, /no_copy, /set return endif pdefs.cset = uv.select if (pdefs.cset eq pdefs.nsets) then begin ; Need to extend the data ; structure data = [data, {graff_data, $ Ndata: 0, $ Type: 0, $ Xydata: handle_create(), $ Descript: ' ', $ Psym: 0, $ Symsize: 1., $ Line: 0, $ Colour: 1, $ Thick: 1, $ Sort: 0b}] handle_value, data(pdefs.cset).xydata, fltarr(2, 2), /set pdefs.nsets = pdefs.nsets+1 endif handle_value, pdefs.data, data, /no_copy, /set graff_set_vals, pdefs, /set_only end