HI.
my problem is that when my font size is bigger than some value, inputdlg function cut vertically the font as you can see in the function.
But is not possible for Matlab to resize vertically the window that inputdlg creates.
How can i solve this problem ?

 採用された回答

Walter Roberson
Walter Roberson 2022 年 4 月 11 日
編集済み: Walter Roberson 2022 年 4 月 11 日

0 投票

What you need to do is take a copy of the code, renaming it to a different function, and edit the line
TextInfo.FontSize = get(0,'FactoryUicontrolFontSize');
to become
TextInfo.FontSize = get(0,'DefaultUicontrolFontSize');
After that, in order to change the font size, just before calling inputdlg(), use
oldsize = get(0, 'DefaultUicontrolFontSize');
set(0, 'DefaultUicontrolFontSize', SIZE_YOU_WANT);
then call inputdlg(), and then
set(0, 'DefaultUicontrolFontSize', oldsize);

4 件のコメント

Davide Di Luzio
Davide Di Luzio 2022 年 4 月 11 日
Hi Mr. Walter. Thanks you for your reply.
Some point are not very clear.
when you say "take a copy of the code" , does you mean to make a copy of inputdlg function to edit ??
"After that, in order to change the font size, just before calling inputdlg()," does you mean the edited inputdlg ??
"set(0, 'DefaultUicontrolFontSize', oldsize);" to restore the previous value as "TextInfo.FontSize = get(0,'FactoryUicontrolFontSize');" correct?
Walter Roberson
Walter Roberson 2022 年 4 月 11 日
Yes, copy inputdlg.m into your own directory, but give it a different name, like
my_inputdlg
and edit that. You would invoke that function instead of the built-in inputdlg()
Example:
SIZE_YOU_WANT = 14;
oldsize = get(0, 'DefaultUicontrolFontSize');
set(0, 'DefaultUicontrolFontSize', SIZE_YOU_WANT);
inputs = my_inputdlg(Appropriate Parameters);
set(0, 'DefaultUicontrolFontSize', oldsize);
The only change between inputdlg.m and my_inputdlg.m would be changing the name of the function inside the file, and changing FactoryUicontrolFontSize to DefaultUicontrolFontSize in one place.
Davide Di Luzio
Davide Di Luzio 2022 年 4 月 11 日
編集済み: Davide Di Luzio 2022 年 4 月 11 日
i have already made the modification but there was this error :
"Unrecognized function or variable 'getnicedialoglocation'.
Error in myinputdlg (line 322)
set(InputFig,'Position',getnicedialoglocation(FigPos,get(InputFig,'Units')));
Error in tipo3A (line 122)
lk = myinputdlg(prompt,dlgtitle,dims,definput,options)"
seem that matlab lost a link with an inside function of my inputdlg modified
Walter Roberson
Walter Roberson 2022 年 4 月 11 日
Copy toolbox/matlab/uitools/private/getnicedialoglocation.m to a directory named private in the directory you stored myinputdlg
You might need to copy some other functions as well.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

製品

リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by