Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Font size option for msgbox?

Subject: Font size option for msgbox?

From: ImageAnalyst

Date: 10 Feb, 2011 17:43:35

Message: 1 of 6

The default font size for msgbox is very small, particularly when
you're operating at high screen resolutions like 1920x1600 or higher.
It looks like it's like 1 point type, well not really, but a capital E
on my screen is only 2 mm high (I measured it). What I would like to
do is have a fontsize option like they do for so many other functions,
such as title(), xlabel(), text(), etc. I'd like to call msgbox like
this:
            uiwait(msgbox('These are big letters', 'FontSize', 16));
but unfortunately no such option seems to be available. Why can't
there be a fontsize option like so many other functions have? Is
there any easy workaround (short of developing my own custom GUI to
display things, which I know I can do)?

Subject: Font size option for msgbox?

From: Sean de

Date: 10 Feb, 2011 18:18:04

Message: 2 of 6

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <b8e24b97-6139-494e-9674-84a8cc79e2ed@y35g2000prc.googlegroups.com>...
> The default font size for msgbox is very small, particularly when
> you're operating at high screen resolutions like 1920x1600 or higher.
> It looks like it's like 1 point type, well not really, but a capital E
> on my screen is only 2 mm high (I measured it). What I would like to
> do is have a fontsize option like they do for so many other functions,
> such as title(), xlabel(), text(), etc. I'd like to call msgbox like
> this:
> uiwait(msgbox('These are big letters', 'FontSize', 16));
> but unfortunately no such option seems to be available. Why can't
> there be a fontsize option like so many other functions have? Is
> there any easy workaround (short of developing my own custom GUI to
> display things, which I know I can do)?

Could you call msgbox with an empty string and then create a static textbox on it with your desired string and fontsize?

It should be a fairly straightforward wrapper for msgbox.

Subject: Font size option for msgbox?

From: Sean de

Date: 10 Feb, 2011 19:00:07

Message: 3 of 6

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <b8e24b97-6139-494e-9674-84a8cc79e2ed@y35g2000prc.googlegroups.com>...
> The default font size for msgbox is very small, particularly when
> you're operating at high screen resolutions like 1920x1600 or higher.
> It looks like it's like 1 point type, well not really, but a capital E
> on my screen is only 2 mm high (I measured it). What I would like to
> do is have a fontsize option like they do for so many other functions,
> such as title(), xlabel(), text(), etc. I'd like to call msgbox like
> this:
> uiwait(msgbox('These are big letters', 'FontSize', 16));
> but unfortunately no such option seems to be available. Why can't
> there be a fontsize option like so many other functions have? Is
> there any easy workaround (short of developing my own custom GUI to
> display things, which I know I can do)?


open msgbox.

%Go to line 249 (R2009b);
%Change to whatever value you want and it works. Obviously a bad idea to edit the stock function though.

Subject: Font size option for msgbox?

From: ImageAnalyst

Date: 10 Feb, 2011 20:51:13

Message: 4 of 6

On Feb 10, 2:00 pm, "Sean de "
<sean.dewol...@nospamplease.umit.maine.edu> wrote:
> open msgbox.
>
> %Go to line 249 (R2009b);
> %Change to whatever value you want and it works.  Obviously a bad idea to edit the stock function though.
-------------------------------------------------------------------------------
Sean:
Wow, Thanks -- I didn't know msgbox was one we had source code for.
It says
Font.FontUnits='points';
Font.FontSize=get(0,'FactoryUIControlFontSize');
Font.FontName=get(0,'FactoryUIControlFontName');
Font.FontWeight=get(figureHandle,'DefaultUicontrolFontWeight');

I wonder if it can be modified somewhere in this "Factory" so I'm not
modifying MATLAB code? Is it some kind of Java setting on my system
that can be set independently of MATLAB? (Sounds like a question for
Yair !)

By the way my displayed font is (2 mm / 25.5 mm per inch) * 72 points
per inch = 5.67 points. Pretty tiny!
ImageAnalyst

Subject: Font size option for msgbox?

From: Yair Altman

Date: 10 Feb, 2011 22:51:03

Message: 5 of 6

ImageAnalyst <imageanalyst@mailinator.com> wrote...
> Wow, Thanks -- I didn't know msgbox was one we had source code for.
> It says
> Font.FontUnits='points';
> Font.FontSize=get(0,'FactoryUIControlFontSize');
> Font.FontName=get(0,'FactoryUIControlFontName');
> Font.FontWeight=get(figureHandle,'DefaultUicontrolFontWeight');
>
> I wonder if it can be modified somewhere in this "Factory" so I'm not
> modifying MATLAB code? Is it some kind of Java setting on my system
> that can be set independently of MATLAB? (Sounds like a question for Yair !)


While 'FactoryXXX' properties cannot be changed, they all have corresponding 'DefaultXXX' properties that can be modified. For example:
set(0,'DefaultUIControlFontSize',12);

Unfortunately, some internal Matlab functions (tabdlg, inputdlg and msgbox) use 'FactoryXXX' rather than 'DefaultXXX' for some properties. If you ask me, it's a programming oversight by MathWorks. I suggest to go ahead and modify the two offending lines to use 'DefaultXXX' and then set the requested default value in your startup.m file.

Yair Altman
http://UndocumentedMatlab.com

Subject: Font size option for msgbox?

From: ImageAnalyst

Date: 12 Feb, 2011 14:47:30

Message: 6 of 6

On Feb 10, 5:51 pm, "Yair Altman" <altmany...@gmailDEL.comDEL> wrote:
> While 'FactoryXXX' properties cannot be changed, they all have corresponding 'DefaultXXX' properties that can be modified. For example:
> set(0,'DefaultUIControlFontSize',12);
>
> Unfortunately, some internal Matlab functions (tabdlg, inputdlg andmsgbox) use 'FactoryXXX' rather than 'DefaultXXX' for some properties. If you ask me, it's a programming oversight by MathWorks. I suggest to go ahead and modify the two offending lines to use 'DefaultXXX' and then set the requested default value in your startup.m file.
>
> Yair Altmanhttp://UndocumentedMatlab.com
-------------------------------------------------------------------------------------
Thanks Yair. I figured it had to be something tricky. I'll try your
suggestion, and I'll also try to remember to put this in as a feature
request for the next version of MATLAB. I would hope it would be easy
and trivial for them to implement.
ImageAnalyst.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us