Path: news.mathworks.com!not-for-mail
From: "James Anderson" <janderson_net@yahoo.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: how to insert textbox and write text in a figure by code (not manually)
Date: Fri, 17 Aug 2007 12:47:14 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 54
Message-ID: <fa45ci$j9b$1@fred.mathworks.com>
References: <fa1nue$lhh$1@fred.mathworks.com> <fa1qs8$83n$1@fred.mathworks.com>
Reply-To: "James Anderson" <janderson_net@yahoo.com>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1187354834 19755 172.30.248.38 (17 Aug 2007 12:47:14 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 17 Aug 2007 12:47:14 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1069706
Xref: news.mathworks.com comp.soft-sys.matlab:424294


Scott,

Another question I forget to ask is that in the command:
set(mTextBox,'String','Hello World')
is there any way to set the string to a two-line text so
that the first line is empty and the second line is "hello
world"? I tried several times but seems that it only works
for one line. 

Thanks,

James
"Scott Frasso" <scott.frasso@mathworks.com> wrote in message
<fa1qs8$83n$1@fred.mathworks.com>...
> Hello James,
> 
> % Create the figure
> mFigure = figure()
> 
> % Create a uicontrol of type "text"
> mTextBox = uicontrol('style','text')
> set(mTextBox,'String','Hello World')
> 
> % To move the the Text Box around you can set and get the
position of Text 
> Box itself
> mTextBoxPosition = get(mTextBox,'Position')
> % The array mTextBoxPosition has four elements
> % [x y length height]
> 
> % Something that I find useful is to set the Position
Units to Characters, 
> the default is pixels
> set(mTextBox,'Units','characters')
> % This means a Text Box with 3 lines of text will have a
height of 3
> 
> -Scott
> 
> "James Anderson" <janderson_net@yahoo.com> wrote in message 
> news:fa1nue$lhh$1@fred.mathworks.com...
> > Hi,
> >
> > I want to insert a textbox in a given location of a figure
> > and write some desciption in it, there is no edge in the
> > textbox. I know how to do this manually, but don't know how
> > to do this with script.
> >
> > Thanks,
> >
> > James 
> 
>