From: Stephen on
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.
From: Andy on
"Stephen " <stephen.bachner(a)navy.mil> wrote in message <i29fi8$dc3$1(a)fred.mathworks.com>...
> 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.

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.)
From: Jan Simon on
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
From: Stephen on
Thanks to both of you!

Cheers,
SteveB.

"Jan Simon" <matlab.THIS_YEAR(a)nMINUSsimon.de> wrote in message <i29p5r$5k5$1(a)fred.mathworks.com>...
> 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
From: Jan Simon on
Dear Stephen,

> Thanks to both of you!

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

Jan