Home > FR3DSource > mEditbox.m

mEditbox

PURPOSE ^

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

SYNOPSIS ^

function editbox(text,title,fontsize,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,fontsize,button) 
0005 
0006 if nargin < 3,
0007   fontsize = 10;
0008 end
0009 
0010 % title may be missing, so assign it second;
0011 %if there is a fourth variable (no matter what it is) a pushbutton will be created to close the window
0012 
0013 if ~exist('title','var')
0014     title='';
0015 end
0016 
0017 fig = figure('NumberTitle','off','MenuBar','none','Name',title,'Visible','off'); 
0018 
0019 %BUG SOLUTION: Visible set to off then to on after putting the text in the
0020 %edit box so that the slide bar will appear at the top when figure appears
0021 
0022 if exist('button','var')
0023   e=.05;      %this value pushes the edit box up to allow enough space for the OK button
0024   buttonh=uicontrol('Style','pushbutton','Units','normalized','Position',[.4 0 .2 e],'String','OK','Callback','close');
0025 else 
0026   e=0;
0027 end
0028 
0029 edith = uicontrol('Style','edit','Units','normalized','Position',[0 e 1 1-e],'BackgroundColor',[1 1 1],...
0030     'Max',length(text),'String',text);
0031 
0032 set(edith, 'FontName', 'FixedWidth')
0033 set(edith, 'FontSize', fontsize)
0034 set(edith, 'HorizontalAlignment','Left')
0035 
0036 %Max insures multiple lines when needed, so that scroll bar is created
0037 % set(edith,'Max',length(text),'String',text);
0038 
0039 drawnow %drawnow is only necessary on R14SP2
0040 set(fig,'Visible','on')
0041

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