mercredi 28 septembre 2022

select multiple checkboses in matlab

I have a gui with nine checkbox in the following code i can select only one of each but what i wanted to add is if the NormeEm checkbox is selected i want to select another checkbox, which i tried to set up at the end of the code by using a switch and 2 cases so that only another one checkbox can be selected but it won't show and it doesn't give me an error code.

       function kgexec4n(Init)
        %KGEXEC4N boite de dialogue "norme" associée à kgexec4
        
        %CAVIAR2, © ALSTOM + OL 2000/04-2003/03
        error(nargchk(0,1,nargin));
        persistent blkParamNorm
        
        %%%% ouverture boite
        if nargin==1
         %"full block path name" du bloc ParamNorme
         blkParamNorm=gcb;
         if ~strcmp(get_param(blkParamNorm,'MaskType'),'ParamNor')
          errordlg(kverranorm(14),'Caviar3','modal')
          return
         end
         %création figure
         hf=kgui4n;
         %en cas de librairie verrouillée on interdit OK
         %x=get_param(get_param(gcs,'Parent'),'Lock');   %modif2.4 10/03/2006
         rep=findstr(gcs,'/');
         if isempty(rep)
            active_sys=gcs;
         else
            active_sys=gcs(1:rep-1)
         end
         x=get_param(active_sys,'Lock')
         set( findobj(hf,'Tag','NormeOK'), 'Enable', onoff(~onoff(x)) )
        else
         hf=gcbf;
        end
    
    %%%% handles des contrôles et dévalidation de tout
    hrb=[findobj(hf,'Tag','Norme0')
     findobj(hf,'Tag','Norme1022')
     findobj(hf,'Tag','NormeEm')
     findobj(hf,'Tag','NormeG53')
     findobj(hf,'Tag','NormeCh')
     findobj(hf,'Tag','NormeUsrV')
     findobj(hf,'Tag','NormeUsrI')
     findobj(hf,'Tag','Norme50160')
     findobj(hf,'Tag','Norme519')];
    hrbVal=get(hrb,'Value');
    set(hrb,'Value',0)
    hno=[findobj(hf,'Tag','Param0')
     findobj(hf,'Tag','Param1022')
     findobj(hf,'Tag','ParamEm')
     findobj(hf,'Tag','ParamG53')
     findobj(hf,'Tag','ParamCh')
     findobj(hf,'Tag','ParamUsrV')
     findobj(hf,'Tag','ParamUsrI')
     findobj(hf,'Tag','Param50160')
     findobj(hf,'Tag','Param519-1')
     findobj(hf,'Tag','Param519-2')
     findobj(hf,'Tag','Param519-3')
     findobj(hf,'Tag','Param519-4')];
    set(hno,'Enable','off')

%%%% gestion dynamique de la boite
switch get(gcbo,'Tag'); %l'objet ayant provoqué l'appel

%dialogue dynamique
case {'Norme0','Norme1022'}
 set(gcbo,'Value',1)
case 'NormeEm'
 set(gcbo,'Value',1),enable(hno(3))
    switch get(gcbo,'Tag');
        case 'Norme1022'
            set(findobj(hf,'Tag','Norme1022'),'Value',1)
        case 'NormeUsrV'
           set(findobj(hf,'Tag','NormeUsrV'),'Value',1),enable(hno(6))  
    end   
case 'NormeG53'
 set(gcbo,'Value',1),enable(hno(4))
case 'NormeCh'
 set(gcbo,'Value',1),enable(hno(5))
case 'NormeUsrV'
 set(gcbo,'Value',1),enable(hno(6))
case 'NormeUsrI'
 set(gcbo,'Value',1),enable(hno(7))
case 'Norme50160'
 set(gcbo,'Value',1),enable(hno(8))
case {'Norme519','Param519-1'}
 set(hrb(9),'Value',1),Scr519(hno(9:12))
end

If i could have some help to figure out what's wrong in my code it would help me a lot




Aucun commentaire:

Enregistrer un commentaire