function message(msg, opt) %MESSAGE Display a message box % % Copyright (c) 1995 by Claudio Rivetti and Mark Young % claudio@alice.uoregon.edu, mark@alice.uoregon.edu % global Uibgcolor ssg edm qq dlgf qq=0; if nargin ==1 opt='NOWAIT'; end ssg=msg; if isempty(Uibgcolor) Uibgcolor=[.55 .55 .55]; end pos=[0 0 0 0]; c=screencenter; pos(1)=c(1)-200; pos(2)=c(2)-90; pos(3)=400; pos(4)=180; if strcmp(upper(opt), 'WAIT') ok_cbk='global qq;qq=1;'; else ok_cbk='global dlgf;close(dlgf);'; end dlgf=figure('name', 'Message',... 'Resize', 'off',... 'NumberTitle', 'off',... 'Position', pos,... 'Color', Uibgcolor); edm=uicontrol('style', 'edit',... 'units', 'normalized',... 'pos', [0.03 0.45 0.94 0.5],... 'min', 1,... 'max', 10,... 'horiz', 'center',... 'string', msg,... 'Callback', 'global edm ssg;set(edm, ''string'', ssg);'); uicontrol('style', 'frame',... 'units', 'normalized',... 'pos', [0.03 0.05 0.94 0.35],... 'background', Uibgcolor); okb=uicontrol('style', 'push',... 'units', 'normalized',... 'pos', [0.4 0.1 0.2 0.2],... 'horiz', 'center',... 'string', 'Ok',... 'Callback', ok_cbk); drawnow; if strcmp(upper(opt), 'WAIT') while qq==0 if ~figflag('Message', 0); return; end end close(dlgf); end return;