Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
uicontrol text says no such property as 'VerticalAlignment'

Subject: uicontrol text says no such property as 'VerticalAlignment'

From: John Doe

Date: 11 Oct, 2012 11:51:08

Message: 1 of 2

http://i46.tinypic.com/261j7es.jpg

Hello. As you can see by the above pic the text in panels on the bottom row is at the top instead of the middle (which is supposed to be the default?)

The panels are created with

TextBox4 = uicontrol('style','text');
set(TextBox4, 'String', 'HOME', 'Position', [(yIncrease*5)+162, xIncrease, 259, 130], 'BackgroundColor',[1 1 1], 'FontSize', 30);

I'm trying to get them to center but whenever I specify the vertical alignment like so
...'BackgroundColor',[1 1 1], 'FontSize', 30, 'VerticalAlignment', 'middle');

it gives me an error saying there's no such property. However it does not when I use the HorizontalAlignment. Help?

Subject: uicontrol text says no such property as 'VerticalAlignment'

From: Yair Altman

Date: 11 Oct, 2012 17:17:10

Message: 2 of 2

"John Doe" wrote in message <k56brc$fip$1@newscl01ah.mathworks.com>...
> http://i46.tinypic.com/261j7es.jpg
>
> Hello. As you can see by the above pic the text in panels on the bottom row is at the top instead of the middle (which is supposed to be the default?)
>
> The panels are created with
>
> TextBox4 = uicontrol('style','text');
> set(TextBox4, 'String', 'HOME', 'Position', [(yIncrease*5)+162, xIncrease, 259, 130], 'BackgroundColor',[1 1 1], 'FontSize', 30);
>
> I'm trying to get them to center but whenever I specify the vertical alignment like so
> ...'BackgroundColor',[1 1 1], 'FontSize', 30, 'VerticalAlignment', 'middle');
>
> it gives me an error saying there's no such property. However it does not when I use the HorizontalAlignment. Help?


For some unknown reason, Matlab uicontrols do not have a vertical alignment property, only horizontal alignment. However, if you access the uicontrol's underlying Java object (via the findjobj utility on the Matlab File Exchange) then you do indeed have this property available.

Read more: http://undocumentedmatlab.com/blog/button-customization/

Yair Altman
http;//UndocumentedMatlab.com
 

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us