Changing properties of menu

1 visualizzazione (ultimi 30 giorni)
David Koenig
David Koenig il 24 Feb 2012
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

Risposta accettata

Sean de Wolski
Sean de Wolski il 24 Feb 2012
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!

Più risposte (0)

Categorie

Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by