Mercurial > hg > ltpda
view m-toolbox/m/gui/gltpda/g_editValueCallback.m @ 52:daf4eab1a51e database-connection-manager tip
Fix. Default password should be [] not an empty string
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 07 Dec 2011 17:29:47 +0100 |
parents | f0afece42f48 |
children |
line wrap: on
line source
function g_editValueCallback(hObject, varargin) global params paramEnabled expandedEdit = 0; if numel(get(hObject,'UserData'))>1 hObject = get(hObject,'UserData'); orighObject = hObject(2); hObject = hObject(1); expandedEdit = 1; else orighObject = hObject; end currParamIndex = get(hObject,'UserData'); newValue = get(hObject,'String'); if isempty(newValue), set(orighObject,'String',num2str(params.params(currParamIndex).val)); return; end if strcmp(newValue(1),''''), paramType = 'char'; newValue(1) = []; newValue(end) = []; for j = numel(newValue)-1:-1:2 if strcmp(newValue(j),'''') && (~strcmp(newValue(j-1),'''') && ~strcmp(newValue(j+1),'''')) newValue = [newValue(1:j),'''',newValue(j+1:end)]; end end elseif ~strcmp(newValue(1),'{'), paramType = 'double'; else paramType = 'double'; end switch paramType case 'double' try newValue = evalin('base',newValue); if isnumeric(newValue) set(orighObject,'String',mat2str(newValue)) else params = pset(params,params.params(currParamIndex).key,newValue); paramcommand = BuildParamCommand(params); for kk=1:length(selBlocks) set_param(selBlocks(kk),'Description',paramcommand); end AnnotationUpdate(params); buildplistFigureParam([],[],get(findobj('Tag','paramsPage'),'UserData')) return end catch oldValue = params.params(currParamIndex).val; if ~isa(oldValue,'char'), mat2str(oldValue); end set(orighObject,'String',oldValue) return end case 'char' params = pset(params,params.params(currParamIndex).key,newValue); end if expandedEdit, paramEnabled(currParamIndex) = 1; end params = pset(params,params.params(currParamIndex).key,newValue); if isempty(findobj('Tag','parampanelFigure')) set(findobj('Tag','apply'),'Enable','on'); set(findobj('Tag','undo'),'Enable','on'); else paramEnabled(currParamIndex) = 1; g_ApplyButtonCallback(); end end