PRO qSave2File_Pick, state, pick=pick ;+ ; NAME: ; qSave2File_Pick ; PURPOSE: ; Sets the name of the output file ; CATEGORY: ; Widget qSave2File ; CALLING SEQUENCE: ; qSave2File_Pick, type=type, /pick ; INPUTS: ; state array[1]; type: structure ; qSave2File state structure ; OPTIONAL INPUT PARAMETERS: ; type=type scalar; type: string ; type to be used as file name extension ; /pick if set then the IDL pickfile dialog is used to let user set ; keyword 'type' takes precedence over /pick ; OUTPUTS: ; (none) ; INCLUDE: @compile_opt.pro ; On error, return to caller ; CALLS: ; InitVar, GetFileSpec ; 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. ; MODIFICATION HISTORY: ; APR-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ;- InitVar, pick, /key IF pick THEN BEGIN widget_control, state.wid_file, get_value=filename filename = filename[0] type = strlowcase(strmid(GetFileSpec(filename,from='type',upto='type'),1)) filename = dialog_pickfile(file=filename, filter='*.'+type, /write) IF filename NE '' THEN widget_control, state.wid_file, set_value=filename ENDIF widget_control, state.wid_file, get_value=filename filename = filename[0] type = strlowcase(strmid(GetFileSpec(filename,part='type'),1)) IF (where(type EQ state.type))[0] NE -1 THEN BEGIN FOR i=0,n_elements(state.type)-1 DO BEGIN tmp = type EQ state.type[i] widget_control, state.wid_type[i], set_button=tmp,set_uvalue=tmp ENDFOR ENDIF RETURN & END