Mercurial > hg > ltpda
comparison m-toolbox/m/gui/gltpda/g_ApplyButtonCallback.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 function g_ApplyButtonCallback(hObject,varargin) | |
2 % Whenever the user clicks on the 'Apply' button. | |
3 | |
4 global params paramEnabled oldparams oldparamEnabled selBlocks | |
5 | |
6 % If it's executed automacally (upon button deletion), check whether | |
7 % there's something to apply or not: | |
8 if (nargin>2 && strcmp(get(hObject,'enable'),'off')) || (isempty(params) && isempty(oldparams)), return; end | |
9 | |
10 % This is to update the old params with those currently stored into | |
11 % the block: | |
12 temp1 = paramEnabled; | |
13 temp2 = params; | |
14 paramcommand = get_param(gcbh,'Description'); | |
15 eval(paramcommand) % This overwrites also the current 'paramEnabled' | |
16 oldparamEnabled = paramEnabled; | |
17 paramEnabled = temp1; | |
18 oldparams = params; | |
19 params = temp2; | |
20 clear temp1 temp2 | |
21 | |
22 % Now to update the block with the latest changed params: | |
23 paramcommand = g_BuildParamCommand(params); | |
24 for kk=1:length(selBlocks) | |
25 try set_param(selBlocks(kk),'Description',paramcommand); catch, end | |
26 end | |
27 g_AnnotationUpdate(params); | |
28 | |
29 try set(hObject,'enable','off'); catch, end | |
30 | |
31 % Redraw the panel only if the user hasn't changed selection or | |
32 % clicked on a different tab: | |
33 if nargin>2 && varargin{2}, selBlocks = nan; end | |
34 | |
35 end |