function files=gui_pop_update(cback_fig,suf,lsuf,tag,cur_file,pref,add_on,ii_sub_dir);
%
% Finds files with suffix suf, puts them in cell array files, updates the 'String'
% of GUI box with 'Tag'=tag, and updates the 'Value' corresponding to the file name
% cur_file.
%
%files=star_files(['*',suf,'*'],lsuf);
if nargin<6, pref=[]; end
if nargin<7, add_on=[]; end
if nargin<8, ii_sub_dir=0; end
%
if ~ischar(suf), suf=char(suf); end
%
if isempty(pref),
	files=star_files(suf,lsuf);
else
	files=star_files(suf,lsuf,pref);
end
% if length(files)==0 & ii_sub_dir,
if ii_sub_dir,
    files2=star_dir_search(suf,lsuf,pref);
    files=[files; files2];
end
if ~isempty(add_on), 
    if ischar(add_on),
        files=[{add_on}; files];
    else
        files=[add_on; files];
    end
end
h1=findobj(cback_fig,'Tag',tag);
if length(files)==0,
	val=1; files={'None Available'};
else
	val=find(strcmp(cur_file,files)); if isempty(val), val=1; end
end
%%if isempty(files), files={' '}; val=1; end;
set(h1,'String',files,'Value',val);
%%tag,h1,files,val
%
% COPYRIGHT (c) 2008
% 
% Applied Research Laboratories, The University of Texas at Austin
% (ARL:UT)
% All rights reserved.
% 
% This material may be reproduced by or for the U.S. Government
% only. This notice must appear in all copies of this file and its
% derivatives. Further distribution outside the U.S. Government is
% prohibited without the explicit written authorization from the
% Director of the Environmental Sciences Laboratory, ARL:UT.
% 
% THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
% EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE
% IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
% PURPOSE, OR NONINFRINGEMENT.
% 
% IN NO EVENT WILL ARL:UT BE LIABLE FOR ANY DAMAGES WHATSOEVER ARISING
% OUT OF THE USE OR INABILITY TO USE THIS SOFTWARE, EVEN IF ARL:UT HAS
% BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
