Setting GUI Control Default Properties by Style
Mostra commenti meno recenti
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')
Risposta accettata
Più risposte (1)
Daniel Shub
il 11 Mag 2011
0 voti
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 Commento
Andy
il 12 Mag 2011
Categorie
Scopri di più su Desktop in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!