Changing font size of built-in dialog boxes
Jiro‘s Pick this week is msgboxFontSize by Adam Danz.
This utility reminded me of a very recent project, which would have benefited greatly. I was building an app that made use of warndlg and errordlg. I needed to show the app as part of a presentation, and that required me to make the fonts bigger. The app itself, I had control over. But there were no parameters I could tweak in warndlg and errordlg to make their fonts bigger. I ended up modifying the built-in functions themselves to allow me to specify the font size.
Adam’s utility would have saved me a lot of trouble. His function takes an existing dialog box created by msgbox, warndlg, errordlg and changes the font size and other properties by searching for the text objects.
For example, take this standard warning dialog.
h = warndlg('This is the normal error dialog','Error');
Let’s change the font size to 30, and while we’re at it, we’ll also change the text.
msgboxFontSize(h,30,'String','Notice how the font is bigger now!');
Notice that the dialog width is adjusted based on the font size.
I have a couple of enhancement requests for Adam.
- It would be great if we could also change the font size of the buttons (“OK” button in the above example).
- It would be even greater if the icon size (the exclamation mark icon in the above example) increased proportionally as well.
Give it a try and let us know what you think here or leave a comment for Adam.
댓글을 남기려면 링크 를 클릭하여 MathWorks 계정에 로그인하거나 계정을 새로 만드십시오.