How can I change the width of a dialog box in MATLAB?

6 views (last 30 days)
I would like to be able to change the width of a dialog box, for example, one that is created using the WARNDLG function. I have a long line of text and I would like it all to fit in one line in the Warning Dialog box.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 16 Sep 2010
The ability to change the width of the warning dialog box so that it displays the text in one line is not available in MATLAB.
A possible workaround is to get the Children of the dialog box. Replace the axes with a text uicontrol whose width can be controlled:
Example:
input={'ddddddddddddssssssssoooooooooooooooooooooooooossssssssssseeeeeeewwwwqqqqqqqqqqqqqqqqqqnnnnnnnnnnnnnnnnnnnnuuuuuuuuuuuuu8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888'};
h = helpdlg(input);
set(0,'ShowHiddenHandles','on');
set(h,'Position',[100,100,500,300]);
ui = get(h,'Children');
delete(ui(2));
y=uicontrol('style','text','string',input,'units','normalized');
set(y,'Position',[.1 .5 .8 .3],'HorizontalAlignment','left');
set(h,'Children',[ui(1) ui(3) y]);

More Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Products


Release

R14SP2

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!