Mercurial > hg > ltpda
view m-toolbox/m/gui/gltpda/g_LoadMuxParamCallback.m @ 37:a4b7ceae0403 database-connection-manager
Show backtrace on unit test errors
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Mon, 05 Dec 2011 16:20:06 +0100 |
parents | f0afece42f48 |
children |
line wrap: on
line source
function g_LoadMuxParamCallback(varargin) % This callback is called whenever the user selects a Mux block (or % Demux). The callback opens the panel to set the only parameter % associated to this type of block: the number of inputs. % The function sets also the dimension of the block accordingly. if strcmp(get(gcbh,'Tag'),'mux'), % Text: 'Number of inputs:' uicontrol('Parent',currPanel,'BackgroundColor',backColor,'Units','pixels','HorizontalAlignment','left','Position',[100 panelDimens(4)-60 100 20],'String','Number of inputs:','Visible','on','Style','text'); % Edit field: uicontrol('Parent',currPanel,'Units','pixels','HorizontalAlignment','center','Position',[210 panelDimens(4)-57 50 20],'String',get(gcbh,'Inputs'),'Visible','on','Enable','on','Callback',@MuxEditCallback,'Style','edit'); elseif strcmp(get(gcbh,'Tag'),'demux'), % Text: 'Number of outputs:' uicontrol('Parent',currPanel,'BackgroundColor',backColor,'Units','pixels','HorizontalAlignment','left','Position',[100 panelDimens(4)-60 100 20],'String','Number of outputs:','Visible','on','Style','text'); % Edit field: uicontrol('Parent',currPanel,'Units','pixels','HorizontalAlignment','center','Position',[210 panelDimens(4)-57 50 20],'String',get(gcbh,'Outputs'),'Visible','on','Enable','on','Callback',@MuxEditCallback,'Style','edit'); end %---------------------------------------------------------------------- function MuxEditCallback(hObject, varargin) % This callback is called whenever the user modify the number of inputs % associated to a Mux block (or outputs to a Demux) newValue = str2double(get(hObject,'String')); % Check it's an integer: newValue = round(newValue); set(hObject,'String',num2str(newValue)); for i=1:length(selBlocks) newDimens=get(selBlocks(i),'Position'); newDimens(4)=newDimens(2)+25*(newValue+1); if strcmp(get(gcbh,'Tag'),'mux'), set(selBlocks(i),'Inputs',num2str(newValue)); elseif strcmp(get(gcbh,'Tag'),'demux'), set(selBlocks(i),'Outputs',num2str(newValue)); end set(selBlocks(i),'Position',newDimens); end end %---------------------------------------------------------------------- end