MATLAB: Does the BackgroundColor of an editable textbox remain white when it has been set to another color in MATLAB 7.7 (R2008b)

graphicsguiguidehandle graphicsMATLAB

I created an editable text box with a BackgroundColor of [0 0.7 0.7]. If I assign a value to the 'String' property while the 'Enable' setting is 'off', the resulting text box will be white isntead of the assigned BackgroundColor. This is contingent upon both setting the String value and the Enable off
%%works
fh=figure
t=uicontrol(fh,'Style','edit','BackgroundColor',[0 .7 .7],'Enable','off')
set(t,'Enable','on')
%%works
fh2=figure
t2=uicontrol(fh2,'Style','edit','BackgroundColor',[0 .7 .7])
set(t2,'String','Hello World')
set(t2,'Enable','on')
%%breaks
fh3=figure
t3=uicontrol(fh3,'Style','edit','BackgroundColor',[0 .7 .7],'Enable','off')
set(t3,'String','Hello World')
set(t3,'Enable','on')
GUIs created in GUIDE are also affected.

Best Answer

This is a expected behavior in the way that MATLAB displays the BackgroundColor for editable text objects. To change this, set the 'Enable' property to 'on' before setting STRING’ property as shown below:
fh=figure
t=uicontrol(fh,'Style','edit','BackgroundColor',[0 .7 .7],'Enable','off')
set(t,'Enable','on');
set(t,'String','Hello World');