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.
Comments
Give it a try and let us know what you think here or leave a comment for Adam.
- 类别:
- Picks
评论
要发表评论,请点击 此处 登录到您的 MathWorks 帐户或创建一个新帐户。