Increase font size in menu interface

20 views (last 30 days)
is it possible to increase the font size of the screen MENU interface because for example when i'm using the below code the menu appear with font to small.
insdati=menu('Can you please help me?','Yes','No')

Accepted Answer

Jan on 25 Dec 2011
UIControl_FontSize_bak = get(0, 'DefaultUIControlFontSize');
set(0, 'DefaultUIControlFontSize', 18);
insdati = menu('Can you please help me?','Yes','No')
set(0, 'DefaultUIControlFontSize', UIControl_FontSize_bak);
I cannot try it currently. The same should work for the text size also. This creates a list of available settings:
get(0, 'Default');
Another idea would be to create a copy of the file "menu.m" and adjust it to your needs. Of course, this does not match the idea of using toolbox functions and code-reusing. But if it works...
Image Analyst
Image Analyst on 26 Dec 2011
I tried it. It works great. Neat, useful snippet of code!
Maurizio on 26 Dec 2011
How can I increse the size for prompt and dlg_title?

Sign in to comment.

More Answers (2)

Walter Roberson
Walter Roberson on 6 Jan 2012
If you happen to be using R2008b (the version I have at hand), then at the command line, command
edit inputdlg.m
Examine near line 70. The section there sets the value for Title if no Title parameter was passed in.
Now scroll through and notice that Title is not referenced again until near line 124, which is a call to dialog() that passes in Title as the value of the 'Name' parameter.
Now at the command line, command
edit dialog.m
If you go through the logic starting from about line 57, where extrapropval is assigned to, through to after the 'for' and 'switch' and 'if' statement afterwards, then you will find that the 'name' parameter is copied in to extrapropval and left there (whereas other items are removed.) Then at around line 85, there is a figure() call in which the remaining extrapropval are passed to figure(), so the 'Name' parameter (along with the Title string that was created in inputdlg()) will be passed to figure().
Now, examine the documentation for figure properties, and notice that Name is indeed the property that is used to give the title to the figure, and notice that Name is not a text object; examine too the rest of the figure properties and notice that there are NO (documented) properties that can modify the font or font size of the Name of the figure window.
Return your attention to dialog.m and observe that there is nothing remaining in the code: in particular no mechanism in dialog.m that uses the Name property some other way, and no code that uses any other value to set the title of the figure window.
At this point, return your attention to inputdlg.m . Read through it or search through it, and observe that the only other use of Title is in setting the Tag property of the figure (by passing it to dialog()). You may wish to experiment to prove to yourself that the Tag property has no effect on the figure window title.
Does this analysis establish to your satisfaction that there is no documented mechanism to change the font or font size for the prompt that is used for inputdlg()? If it does not then I suggest that instead of reposting the same question that you open a support case with MathWorks, as MathWorks might know of some undocumented mechanism.

Walter Roberson
Walter Roberson on 5 Jan 2012
For menu():
The dialog title 'MENU' is handled by the figure Name property, which does not have any size or font controls documented. (There might be some Java way to do it.)
The prompt is handled by a straight uicontrol(), just as the other lines are. You could increase the DefaultUicontrolFontSize, but that would affect all of the lines.
For inputdlg():
The dialog title is handled by the figure Name property, which does not have any size or font controls documented. (There might be some Java way to do it.)
The prompts are handled by a uicontrol() which is passed a FontSize control with the font set to the FactoryUIControlFontSize (which cannot be changed.) However, inputdlg() allows you to pass in an 'Interpreter' parameter, which is passed in to the uicontrol(), so you could set that to tex or latex and use whatever facilities available in those to change the font sizes.


Find more on Interactive Control and Callbacks in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!