Changeset 500 for trunk/src/fill_GUI.m


Ignore:
Timestamp:
Jul 24, 2012, 7:58:33 PM (12 years ago)
Author:
sommeria
Message:

various bug corrections

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/fill_GUI.m

    r497 r500  
    1717% loop on the elements of the input structure Param
    1818for 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
    2021        if isfield(handles,fields{ifield})
    2122            set(handles.(fields{ifield}),'Visible','on')
     
    2627            errormsg=fill_GUI(Param.(fields{ifield}),hchild);% apply the function to the substructure
    2728        end
     29    % case of an element
    2830    else
    2931        hh=[];
    3032        input_data=Param.(fields{ifield});
     33                    display(fields{ifield})
     34                    display(input_data)
    3135        check_done=0;
    3236        if isfield(handles,fields{ifield})
     
    4044                check_done=1;
    4145            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
    4459        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')
    4763%             input_data
    48             switch get(hh,'Style')
     64            switch get(hh(ibox),'Style')
    4965                case {'checkbox','radiobutton','togglebutton'}
    5066                    if isnumeric(input_data)
    51                         set(hh,'Value',input_data)
     67                        set(hh(ibox),'Value',input_data(ibox))
    5268                    end
    5369                case 'edit'
    5470                    if isnumeric(input_data)
    55                         input_data=num2str(input_data);
     71                        input_string=num2str(input_data(ibox));
     72                    else
     73                        input_string=input_data;
    5674                    end
    57                     set(hh,'String',input_data)
     75                    set(hh(ibox),'String',input_string)
    5876                case{'listbox','popupmenu'}
    5977                    if isnumeric(input_data)
    6078                        input_data=num2str(input_data);
    6179                    end
    62                     menu=get(hh,'String');
     80                    menu=get(hh(ibox),'String');
    6381                    if ischar(input_data)
    6482                        input_data={input_data};
     
    7492                        end
    7593                    end
    76                     set(hh,'String',menu)
    77                     set(hh,'Value',values)
     94                    set(hh(ibox),'String',menu)
     95                    set(hh(ibox),'Value',values)
    7896            end
     97        end
    7998        end
    8099    end
Note: See TracChangeset for help on using the changeset viewer.