Setting GUI Control Default Properties by Style
Ältere Kommentare anzeigen
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')
Akzeptierte Antwort
Weitere Antworten (1)
Daniel Shub
am 11 Mai 2011
0 Stimmen
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 Kommentar
Andy
am 12 Mai 2011
Kategorien
Mehr zu Desktop finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!