www.pudn.com > Closid30.rar > CLYESNO.M, change:1998-05-18,size:1617b


function clyesno(clb,str1,str2,str3,str4,str5,str6,str7,str8) 
% clyesno(clb,str1,str2,str3,str4,str5,str6,str7,str8) 
% 
% Ask for a yes/no answer. Displays the message contained in 
% the strings str1 .. str8 in a yes/no box in the middle of the 
% screen. If the YES-button is clicked, the callback defined 
% by the input parameter clb will be invoked. 
 
% 25-06-1996 
% (c) Raymond de Callafon, Douwe de Vries, Paul Van den Hof 
% Mechanical Engineering Systems and Control Group 
% Delft University of Technology 
% Last update: 18-05-1998 
 
x=get(0,'Screensize'); 
n1=nargin-1; 
n2=0; 
for t=1:n1, 
   str=eval(['str' num2str(t)]); 
   if length(str)>n2, 
      n2 = length(str); 
   end 
end 
 
ypos=30+n1*22; 
xpos=n2*13; 
if xpos<150, xpos=150; end 
 
pos = [(x(3)-x(1)+1)/2-xpos/2 (x(4)-x(2)+1)/2-ypos/2 xpos ypos]; 
 
figure('Position',pos,'Visible','on','Menubar','None',... 
   'name','Question','Interruptible','off','color','w',... 
   'NumberTitle','Off','resize','off'); 
 
axes('position',[0 0 1 1],'visible','off','box','off'); 
 
for t=1:n1, 
   text(pos(3)/2,pos(4)-22*t,eval(['str' num2str(t)]), ... 
      'Units','Pixels','HorizontalAlignment','center', ... 
      'VerticalAlignment','baseline', ... 
      'FontName','Helvetica','Fontsize',12,... 
      'FontWeight','bold','Color','k'); 
end 
drawnow; 
 
uicontrol(gcf,'Style','push','Units','Pixels', ... 
   'Position',[pos(3)-65 5 60 20],'String','NO', ... 
   'Callback','delete(gcf)'); 
uicontrol(gcf,'Style','push','Units','Pixels', ... 
   'Position',[pos(3)-130 5 60 20],'String','YES', ... 
   'Callback',[clb 'delete(gcf)']);