Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Minimum size for text

0 views
Skip to first unread message

Eyal Fleminger

unread,
Dec 31, 2009, 9:11:03 AM12/31/09
to
I have a static text uicontrol. I want to know what the minimum width and height (the last two elements of the Position proerty vector) settings are such that all the text will still be visible. I though I could get this with the Extent property, but this gives the same values as Position.

Thx

Andy

unread,
Dec 31, 2009, 9:34:05 AM12/31/09
to
"Eyal Fleminger" <efle...@gmail.com> wrote in message <hhibdn$b0b$1...@fred.mathworks.com>...

> I have a static text uicontrol. I want to know what the minimum width and height (the last two elements of the Position proerty vector) settings are such that all the text will still be visible. I though I could get this with the Extent property, but this gives the same values as Position.
>
> Thx

In general, you can just use trial and error. If you make the text box too small, then part of your text will not show. Then you can slowly adjust the size until it shows. I believe that if you set the units to characters, one character is 5 pixels wide by 13 pixels tall. And then there are a few pixels between each letter. So that should give you a way to make a good educated first guess, and then tweak.

us

unread,
Dec 31, 2009, 9:48:04 AM12/31/09
to
"Eyal Fleminger" <efle...@gmail.com> wrote in message <hhibdn$b0b$1...@fred.mathworks.com>...
> I have a static text uicontrol. I want to know what the minimum width and height (the last two elements of the Position proerty vector) settings are such that all the text will still be visible. I though I could get this with the Extent property, but this gives the same values as Position.
>
> Thx

a hint:
- to get an idea...

help textwrap;

us

Jan Simon

unread,
Dec 31, 2009, 12:47:04 PM12/31/09
to
Dae Eyal!

> I have a static text uicontrol. I want to know what the minimum width and height (the last two elements of the Position proerty vector) settings are such that all the text will still be visible. I though I could get this with the Extent property, but this gives the same values as Position.

Same answer for 'Position' and 'Extent' property?!
Which OS and Matlab version?

On Windows with Matlab 6.5 and 2009a:
H = uicontrol('Style', 'text', 'String', 'a');
get(H, 'Position')
> 20 20 60 20
get(H, 'Extent')
> 0 0 10 18
set(H, 'String', 'asd')
get(H, 'Extent')
> 0 0 22 18

So actually the 3rd value of the property 'Extent' should satisfy your needs.
Did I miss the point?

Kind regards, Jan

Eyal Fleminger

unread,
Jan 3, 2010, 7:01:04 AM1/3/10
to
Thanks to everyone who replied - it looks like the problem was caused by changes to the Units setting and a few other things.
0 new messages