Home > FR3DSource > mEditBoxWrap.m

mEditBoxWrap

PURPOSE ^

mEditbox(text,title,button) creates a text window

SYNOPSIS ^

function editbox(text,title,button)

DESCRIPTION ^

 mEditbox(text,title,button) creates a text window
Ali Mokdad, Aug 2006

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % mEditbox(text,title,button) creates a text window
0002 %Ali Mokdad, Aug 2006
0003 
0004 function editbox(text,title,button) 
0005 
0006 % title may be missing, so assign it second;
0007 %if there is a third variable (no matter what it is) a pushbutton will be created to close the window
0008 
0009 if ~exist('title','var')
0010     title='';
0011 end
0012 
0013 fig = figure('NumberTitle','off','MenuBar','none','Name',title,'Visible','off'); 
0014 
0015 %BUG SOLUTION: Visible set to off then to on after putting the text in the
0016 %edit box so that the slide bar will appear at the top when figure appears
0017 
0018 if exist('button','var')
0019   e=.05;      %this value pushes the edit box up to allow enough space for the OK button
0020   buttonh=uicontrol('Style','pushbutton','Units','normalized','Position',[.4 0 .2 e],'String','OK','Callback','close');
0021 else 
0022   e=0;
0023 end
0024 
0025 edith = uicontrol('Style','edit','Units','normalized','Position',[0 e 1 1-e],'BackgroundColor',[1 1 1]);
0026 
0027 set(edith, 'FontSize', 10);
0028 set(edith, 'HorizontalAlignment','Left');
0029 
0030 %[outstring,newpos] = textwrap(edith,text);
0031 %outstring
0032 
0033 set(edith,'Max',length(text));
0034 set(edith,'String',text);
0035 
0036 drawnow                       %drawnow is only necessary on R14SP2
0037 set(fig,'Visible','on')
0038

Generated on Fri 03-Apr-2009 09:52:35 by m2html © 2003