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

vertical alignment of text in uicontrol

1,225 views
Skip to first unread message

Naor Movshovitz

unread,
Nov 5, 2008, 5:25:03 PM11/5/08
to
Is there really no vertical alignment option for GUI text objects 'text' and 'edit'? Is there a workaround?

Thanks,
-naor

Walter Roberson

unread,
Nov 5, 2008, 5:53:37 PM11/5/08
to
Naor Movshovitz wrote:
> Is there really no vertical alignment option for GUI text objects 'text' and 'edit'?

text() offers 'HorizontalAlignment' and 'VerticalAlignment' parameters.

There is no such thing in Matlab as a "GUI text objects 'edit'"

uicontrol objects of Style 'text' or 'edit' offer a 'HorizontalAlignment'
option but no vertical alignment option.

> Is there a workaround?

Yes, if you are willing to go in at the Java level and reprogram how that
uicontrol works.

--
.signature note: I am now avoiding replying to unclear or ambiguous postings.
Please review questions before posting them. Be specific. Use examples of what you mean,
of what you don't mean. Specify boundary conditions, and data classes and value
relationships -- what if we scrambled your data or used -Inf, NaN, or complex(rand,rand)?

Naor Movshovitz

unread,
Nov 5, 2008, 6:11:02 PM11/5/08
to
Walter Roberson <robe...@hushmail.com> wrote in message <qtpQk.1856$Mq5....@newsfe01.iad>...

> text() offers 'HorizontalAlignment' and 'VerticalAlignment' >parameters.

but no scroll bar sadly



> uicontrol objects of Style 'text' or 'edit' offer >a 'HorizontalAlignment'
> option but no vertical alignment option.

that's what i thought was odd. anyway, at least i am reassured it's not just me. thanks.

-naor

Walter Roberson

unread,
Nov 5, 2008, 7:09:12 PM11/5/08
to


Perhaps the FEX contribution for scrollable editable tables would be of interest,
http://www.mathworks.com/matlabcentral/fileexchange/6734

Naor Movshovitz

unread,
Nov 5, 2008, 7:19:01 PM11/5/08
to
Walter Roberson <robe...@hushmail.com> wrote in message > Perhaps the FEX contribution for scrollable editable tables would be of interest,
> http://www.mathworks.com/matlabcentral/fileexchange/6734
yes it would. thanks Walter.

Pooya89

unread,
Apr 24, 2013, 11:15:09 PM4/24/13
to
In R2012b vertical alignment for uicontrol is still not supported, but here is a workaround:
My purpose of vertical alignment : I am using a resizable figure with some text and labels within to show some numbers. If I use text (as label) and edit (to show number), their vertical alignment doesn't match (text is top, edit is center).
Solution:
I use edit for both. To prevent the first one (which is just description) from being changed by user, set its 'Enable' property to 'inactive'. Background color does not change.
Vertical alignment for text is 'center' which is nice.

Alexander H

unread,
Dec 16, 2016, 9:26:08 AM12/16/16
to
"Pooya89" wrote in message <kla73t$nqh$1...@newscl01ah.mathworks.com>...
Your method works well for me, thanks for your sharing.
0 new messages