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

Multiple line push button string

359 views
Skip to first unread message

Stephen

unread,
Jul 22, 2010, 9:03:04 AM7/22/10
to
How do I get a multiple line push button string? In the create function I tried,

str = sprintf('Overplot\nSelected\Variables');
set(hObject,'String',str);

This resulted in only "Overplot" appearing on the push button.

Cheers,
SteveB.

Andy

unread,
Jul 22, 2010, 9:23:04 AM7/22/10
to
"Stephen " <stephen...@navy.mil> wrote in message <i29fi8$dc3$1...@fred.mathworks.com>...

I don't know that it's possible with just the MATLAB uicontrol. But you can do it with Java. Download findjobj from the FEX, and look at the function createJButton. (This is the function used to create the buttons along the bottom of the GUI, which are multi-line buttons. These buttons are created around line 1300.)

Jan Simon

unread,
Jul 22, 2010, 11:47:07 AM7/22/10
to
Dear Stephen,

see also createButtonLabel of Brett Shoelson:
http://www.mathworks.com/matlabcentral/fileexchange/15018
and uibutton of Doug Schwarz:
http://www.mathworks.com/matlabcentral/fileexchange/10743

Modern Matlab versions can interprete HTML in buttons also, but this is not documented:
uicontrol('style', 'pushbutton', 'position', [10, 10, 200, 200], ...
'String', '<html>Line 1<br>Line2');

Good luck, Jan

Stephen

unread,
Jul 22, 2010, 12:38:04 PM7/22/10
to
Thanks to both of you!

Cheers,
SteveB.

"Jan Simon" <matlab.T...@nMINUSsimon.de> wrote in message <i29p5r$5k5$1...@fred.mathworks.com>...

Jan Simon

unread,
Jul 22, 2010, 1:02:39 PM7/22/10
to
Dear Stephen,

> Thanks to both of you!

And thanks to Yair in addition for the <html> trick.

Jan

Yair Altman

unread,
Jul 22, 2010, 2:56:06 PM7/22/10
to
"Jan Simon" <matlab.T...@nMINUSsimon.de> wrote in message <i29tjf$l8p$1...@fred.mathworks.com>...

See more information about the HTML support here:
http://UndocumentedMatlab.com/blog/html-support-in-matlab-uicomponents/

Yair Altman
http://UndocumentedMatlab.com

0 new messages