pro qset_page_pick, state, type=type, pick=pick @compile_opt.pro ; On error, return to caller ;+ ; NAME: ; qset_page_pick ; PURPOSE: ; Sets the name of the file used for the graphics output ; CATEGORY: ; Widget qset_page ; CALLING SEQUENCE: ; qset_page, state, pick=pick, type=type ; INPUTS: ; state array[1]; type: structure ; qset_page state structure ; OPTIONAL INPUT PARAMETERS: ; type=type scalar; type: string ; 3-char type to be used as file name extension (bmp, eps, gif) ; /pick if set then the IDL pickfile dialog is used to let user set ; keyword 'type' takes precedence over /pick ; OUTPUTS: ; (none) ; CALLS: ; SetFileSpec, GetFileSpec, qset_page_update ; PROCEDURE: ; The current file name from the wid_file widget is picked up. ; If keyword 'type' is used then the wid_file name is used with extension 'type' ; If /pick is set then the IDL pickfile dialog is called to set the filename ; If neither is set then the wid_file name is used unmodified ; ; The new file name is stored in the wid_file widget. Then qset_page_update is used ; to update the values and user values in the qset_page widget. ; MODIFICATION HISTORY: ; APR-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ;- widget_control, state.wid_file, get_value=File File = File[0] SetFileSpec, File if n_elements(type) ne 0 then $ File = GetFileSpec(upto='name')+'.'+type $ else if keyword_set(pick) then begin type = strmid(GetFileSpec(from='type',upto='type'),1) File = dialog_pickfile(file=File, filter='*.'+type, /write) endif else $ File = GetFileSpec() if File[0] ne '' then begin widget_control, state.wid_file, set_value=File[0] SetFileSpec, File[0] type = strupcase( strmid(GetFileSpec(from='type',upto='type'),1) ) qset_page_update, state, type endif return & end