Mercurial > hg > ltpda
comparison m-toolbox/m/gui/gltpda/g_LoadFromBlockCallback.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_LoadFromBlockCallback(currPanel,varargin) | |
2 % This callback is called whenever the user selects a From block. | |
3 | |
4 global guiFontSize | |
5 panelDimens = get(currPanel, 'Position'); | |
6 backColor = get(currPanel, 'BackgroundColor'); | |
7 | |
8 % Button: 'Find origin' | |
9 uicontrol('Parent',currPanel,'Units','pixels','HorizontalAlignment','center','Position',[(panelDimens(4)-200)/2 panelDimens(4)-100 200 30],'String','Find origin','FontSize',guiFontSize+1,'Visible','on','Enable','on','Callback',@FindOriginCallback,'Style','pushbutton'); | |
10 | |
11 | |
12 | |
13 %---------------------------------------------------------------------- | |
14 function FindOriginCallback(varargin) | |
15 % This callback is called whenever click on the 'Find Origin' button, | |
16 % having selected a 'From' block. | |
17 | |
18 varName = get(gcbh,'GotoTag'); | |
19 origin = utils.prog.find_in_models(bdroot,'LookUnderMasks','all','BlockType','Goto','GotoTag',varName); | |
20 if numel(origin)>1 | |
21 % Error text: there are multiple origins. | |
22 uicontrol('Parent',currPanel,'BackgroundColor',backColor,'Units','pixels','HorizontalAlignment','center','Position',[(panelDimens(4)-400)/2 panelDimens(4)-160 400 30],'String','Error: there are multiple sources','Visible','on','Style','text'); | |
23 elseif numel(origin)==1 | |
24 % Text: full path of the origin. | |
25 uicontrol('Parent',currPanel,'BackgroundColor',backColor,'Units','pixels','HorizontalAlignment','center','Position',[(panelDimens(4)-400)/2 panelDimens(4)-160 400 30],'String',origin{1},'Visible','on','Style','text'); | |
26 else | |
27 % Error text: no origin found. | |
28 uicontrol('Parent',currPanel,'BackgroundColor',backColor,'Units','pixels','HorizontalAlignment','center','Position',[(panelDimens(4)-400)/2 panelDimens(4)-160 400 30],'String','Error: no source found','Visible','on','Style','text'); | |
29 end | |
30 end | |
31 %---------------------------------------------------------------------- | |
32 | |
33 end |