Changing properties of menu

1 次查看(过去 30 天)
I am trying to increase the font size in the menu. In the script below I am able to do that but it also increases the font size in subsequent plots even though I do reset the font size within the loop. Also, if I click on "quit" I get out of the loop and the final plot has the desired smaller font size. Finally, I always get "MENU: No menu items to choose from." whenever I run this script. Therefore, is it possible to change the font size of the menu entries and then change it back for any plots to follow...and how do I get rid of the "MENU: No menu items to choose from." messages?
Here is the test script:
close all; clear;
ii=1;
while ii==1
fh=menu;
set(fh,'ScreenPixelsPerInch', [150]);
kk=menu('Choose','quit','continue');
set(menu,'ScreenPixelsPerInch', [96]);
fh=figure;
plot(1:10,1:10),grid
title('Test Plot')
if kk==1
break
end
end
Thanks,
Dave

采纳的回答

Sean de Wolski
Sean de Wolski 2012-2-24
This line causes the "no items to choose from warning":
fh=menu;
The reason this is working at all is because you are changing the root property (i.e. MATLAB base property) screenpixelsperinch
This happens because
fh = menu
returns 0, the root identifier. To get the behavior you want:
ii=1;
while ii==1
oldSPPI = get(0,'screenpixelsperinch'); %store old one
set(0,'screenpixelsperinch',200); %increase - will affect everything
kk = menu('choose','me','no me!','go home it''s Friday!');
set(0,'screenpixelsperinch',oldSPPI); %restore
figure;
plot(1:10,1:10),grid
title('Test Plot')
if kk==1
break
end
end
Thus the reason it affects everything, is, well you're changing MATLAB's settings.
If this functionality is really important to you, I suggest you write your own menu function and increase the fontsize of the uicontrols manually. See Matt Fig's demos:
Post a new question if you choose to go this route and need assistance!

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by