iluke_update_state

PURPOSE ^

SYNOPSIS ^

function iluke_update_state(s,visible)

DESCRIPTION ^

 This function recursively update the state of objects

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function iluke_update_state(s,visible)
0002 %
0003 % This function recursively update the state of objects
0004 %
0005 if isfield(s,'handle'),
0006     if isfield(s,'highlight'),
0007         if s.highlight,
0008             set(s.handle,'BackgroundColor',[0 0.75 0]);
0009         else
0010             set(s.handle,'BackgroundColor',[0.701961 0.701961 0.701961]);
0011         end
0012     end
0013     if isfield(s,'state')
0014         set(s.handle,'Enable',s.state);
0015     end
0016     if isfield(s,'value') && isfield(s,'string')
0017         set(s.handle,'String',s.string,'Value',s.value);
0018     elseif isfield(s,'string')
0019         set(s.handle,'String',s.string);
0020     elseif isfield(s,'value')
0021         set(s.handle,'Value',s.value);
0022     end
0023     if isfield(s,'visible')
0024         set(s.handle,'Visible',s.visible);
0025     elseif nargin > 1
0026         set(s.handle,'Visible',visible);
0027     end
0028 elseif isstruct(s),
0029     %
0030     fnames = fieldnames(s);
0031     %
0032     for ifield = 1:length(fnames),
0033         %
0034         if isfield(s,'state') && isfield(s.(fnames{ifield}),'handle'),
0035             s.(fnames{ifield}).state = s.state;
0036         end
0037         %
0038         if isfield(s,'visible'),
0039             iluke_update_state(s.(fnames{ifield}),s.visible)
0040         elseif nargin > 1
0041             iluke_update_state(s.(fnames{ifield}),visible)
0042         else
0043             iluke_update_state(s.(fnames{ifield}))
0044         end
0045         %
0046     end
0047 end
0048 %

Community support and wiki are available on Redmine. Last update: 18-Apr-2019.