GUIDE Static Text - Right Align Cuts Off Text

7 ビュー (過去 30 日間)
Matt
Matt 2013 年 1 月 4 日
コメント済み: Walter Roberson 2020 年 3 月 8 日
I have created a series of right-aligned static text boxes to display numbers. The right-align is so that the decimal points are aligned. For some reason the last digit is slightly cut off. Has anyone dealt with this? I'd rather not have to add a space every time I write a number to these boxes. Thanks
-Matt

回答 (2 件)

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 1 月 4 日
編集済み: Azzi Abdelmalek 2013 年 1 月 4 日
Increase the size of your edit text box
pos=get(handles.edit1,'position')
pos(3)=pos(3)+10 % you will increase just the width
set(handles.edit1,'Position',pos)
you can also determine the number of digit to adjust the size of your edit text box
  2 件のコメント
Matt
Matt 2013 年 1 月 4 日
This has no effect. The text box is already quite a bit larger than needed.
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 1 月 4 日
then reduce the fontsize
set(handles.edit1,'FontUnits','point');
set(handles.edit1,'Fontsize',yoursize)

サインインしてコメントする。


Sean de Wolski
Sean de Wolski 2013 年 1 月 4 日
編集済み: Sean de Wolski 2013 年 1 月 4 日
Just add a space to the end of the string:
uicontrol('Style','Text','HorizontalAlignment','right',...
'String','3.1425926535897932384626433 ','Units',...
'Pixels','Position',[20 20 200 20])
  2 件のコメント
Walter Roberson
Walter Roberson 2020 年 3 月 8 日
Ralph comments:
This is not a fix. It's just a workaround. And 7 years later in 2020 it is still an issue.
Walter Roberson
Walter Roberson 2020 年 3 月 8 日
Ralph, this will not be fixed. GUIDE is deprecated and will go away within a small number of releases. I do not know exactly when it will go away, but I would not expect it to still be present in R2022a.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by