How can I display multiline text in a push button by setting its 'String' property ?

조회 수: 45 (최근 30일)
Typing a very long string in the push button uicontrol object's 'String' property causes the displayed text to be truncated if the pushbutton object is not long enough to accommodate the entire string.
How can I wrap the text to prevent it from getting truncated ? Is it possible to display multiline strings in the push button?

채택된 답변

MathWorks Support Team
MathWorks Support Team 2009년 6월 27일
As of MATLAB 7.1 (R14SP3), push buttons do not support multiline text. This is in line with Windows UI design standards.
The workaround to the problem is to modify the size of the push button in the GUI design to accommodate the longest string that it will hold at any time.
Alternatively, you can use a static-text object to display the information, since static-text objects can be multiline.
  댓글 수: 1
Matt J
Matt J 2017년 8월 10일
편집: Matt J 2017년 8월 10일
Alternatively, you can use a static-text object to display the information, since static-text objects can be multiline.
How do you make static text multi-line? Can it be done by modifying the 'String' property in the Property Editor?

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Rob Campbell
Rob Campbell 2019년 11월 20일
You can have multi-line text in a button as follows:
h_button.String='<html>line one<br />line 2 &pi</html>';
This is tested in R2019b. I don't know when this option became available.

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

제품


릴리스

R14SP1

Community Treasure Hunt

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

Start Hunting!

Translated by