Changeset 500 for trunk/src/fill_GUI.m
- Timestamp:
- Jul 24, 2012, 7:58:33 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/fill_GUI.m
r497 r500 17 17 % loop on the elements of the input structure Param 18 18 for ifield=1:numel(fields) 19 if isstruct(Param.(fields{ifield}))% case of sa sub-structure 19 % case of a sub-structure --> fill a panel 20 if isstruct(Param.(fields{ifield}))% case of a sub-structure 20 21 if isfield(handles,fields{ifield}) 21 22 set(handles.(fields{ifield}),'Visible','on') … … 26 27 errormsg=fill_GUI(Param.(fields{ifield}),hchild);% apply the function to the substructure 27 28 end 29 % case of an element 28 30 else 29 31 hh=[]; 30 32 input_data=Param.(fields{ifield}); 33 display(fields{ifield}) 34 display(input_data) 31 35 check_done=0; 32 36 if isfield(handles,fields{ifield}) … … 40 44 check_done=1; 41 45 end 42 elseif isnumeric(input_data) && isfield(handles,['num_' fields{ifield}]) 43 hh=handles.(['num_' fields{ifield}]); 46 elseif isnumeric(input_data) 47 if numel(input_data)>1 48 %deals with array displayed in multiple boxes labeled by an index 49 for ibox=1:numel(input_data) 50 if isfield(handles,['num_' fields{ifield} '_' num2str(ibox)]) 51 hh(ibox)=handles.(['num_' fields{ifield} '_' num2str(ibox)]); 52 end 53 end 54 else % single box (usual case) 55 if isfield(handles,['num_' fields{ifield}]) 56 hh=handles.(['num_' fields{ifield}]); 57 end 58 end 44 59 end 45 if ~isempty(hh)&& ~check_done 46 set(hh,'Visible','on') 60 for ibox=1:numel(hh) 61 if ~isempty(hh(ibox))&& ~check_done 62 set(hh(ibox),'Visible','on') 47 63 % input_data 48 switch get(hh ,'Style')64 switch get(hh(ibox),'Style') 49 65 case {'checkbox','radiobutton','togglebutton'} 50 66 if isnumeric(input_data) 51 set(hh ,'Value',input_data)67 set(hh(ibox),'Value',input_data(ibox)) 52 68 end 53 69 case 'edit' 54 70 if isnumeric(input_data) 55 input_data=num2str(input_data); 71 input_string=num2str(input_data(ibox)); 72 else 73 input_string=input_data; 56 74 end 57 set(hh ,'String',input_data)75 set(hh(ibox),'String',input_string) 58 76 case{'listbox','popupmenu'} 59 77 if isnumeric(input_data) 60 78 input_data=num2str(input_data); 61 79 end 62 menu=get(hh ,'String');80 menu=get(hh(ibox),'String'); 63 81 if ischar(input_data) 64 82 input_data={input_data}; … … 74 92 end 75 93 end 76 set(hh ,'String',menu)77 set(hh ,'Value',values)94 set(hh(ibox),'String',menu) 95 set(hh(ibox),'Value',values) 78 96 end 97 end 79 98 end 80 99 end
Note: See TracChangeset
for help on using the changeset viewer.