Setting GUI Control Default Properties by Style
Afficher commentaires plus anciens
When setting default values for GUI control properties, you can set default properties for all uicontrols:
f = figure;
set(f,'DefaultUicontrolString','Hello World');
uicontrol('parent',f,'style','text')
But can you set different sets of defaults for uicontrols with different styles? The following does NOT work, but makes my intent clear:
f = figure;
set(f,'DefaultTextBackgroundColor','gray')
set(f,'DefaultEditBackgroundColor','white')
uicontrol(f,'style','text','string','hello')
uicontrol(f,'style','edit','string','world')
Réponse acceptée
Plus de réponses (1)
Daniel Shub
le 11 Mai 2011
0 votes
You cannot control the properties like you want. You could create a new function (or even class) that mimics uicontrols, but would allow you to specify default values. One problem with your example is if you create a text box control and then change it to an edit box control would the background color change?
1 commentaire
Andy
le 12 Mai 2011
Catégories
En savoir plus sur Desktop dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!