function [s,c]=di_inp_c(txt,def,flag)

% function [s,c]=di_inp_c(txt,def,flag)
%
% This function is used in conjuction with FD3.  It creates a dialog box with
% one input labeled 'txt'.  The default value for that input is 'def'.  The
% string which is input is returned as 's'.  If 'flag' is set to 1, the user
% can enter a blank string as a response.  If 'flag' is set to 0, the user
% cannot enter a blank string as a response.  The flag 'c' is set to 1 if the
% user hit cancel and 0 if the user hit done.
%
% ACP

% Last update:  July 15, 1993
% Author:       Adrian C. Penisson

global FD3DITEMP FD3PXPERCM FD3FIGURE

FD3DITEMP=0;

%%%%%%%%%%%%%%%%%%%%%
% set up dialog box %
%%%%%%%%%%%%%%%%%%%%%

c=[2.75 2.125];
cv=2.54*[FD3PXPERCM FD3PXPERCM];

fh=uicontrol('Sty','frame','Pos',[c(1)-1.5 c(2)-1 3 2].*cv);
th=uicontrol('Sty','text','Pos',[c(1)-1.4 c(2)+.3 2.8 .3].*cv,'Str',txt);
eh=uicontrol('Sty','edit','Pos',[c(1)-1.3 c(2)-.2 2.6 .2].*cv,'Str',def);
ch=uicontrol('Sty','push','Pos',[c(1)-1.1 c(2)-.8 .8 .4].*cv,'Str',...
   'CANCEL','Call','FD3DITEMP=2;');
dh=uicontrol('Sty','push','Pos',[c(1)+.3 c(2)-.8 .8 .4].*cv,'Str','DONE',...
   'Call','FD3DITEMP=1;');

h=[fh th eh ch dh];

set(h,'Units','Pixels');

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% make necessary changes if B&W %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%if get(0,'ScreenDepth')==1
%   for i=1:5
%      set(h(i),'ForegroundColor',[1 1 1],'BackgroundColor',[0 0 0])
%   end
%end

%%%%%%%%%%%%%%%%%%%%%%%%%%%
% wait for user to finish %
%%%%%%%%%%%%%%%%%%%%%%%%%%%

s='';

while (FD3DITEMP*(length(s)|flag)==0 & FD3DITEMP~=2)
   pause(.01)
   s=deblank(fliplr(deblank(fliplr(get(eh,'String')))));
end

if length(s)==0
   s='';
end

c=FD3DITEMP-1;

close(h)
