Home > bioelectromagnetism > gui_updateparent.m

gui_updateparent

PURPOSE ^

gui_updateparent - General GUI data handing for EEG Toolbox

SYNOPSIS ^

function [p] = gui_updateparent(UserData,focus)

DESCRIPTION ^

 gui_updateparent - General GUI data handing for EEG Toolbox

 Usage: [p] = gui_updateparent(UserData,focus)

 'UserData' is obtained from get(gcbf,'UserData'), where all
 the necessary parameters and stored for each GUI, including
 the handles of any GUI parent.

 'focus' is a boolean option that switches whether the 
 parent is the current figure (1, default) or not (0).
 
 This function returns the p struct to both the matlab
 workspace and any direct parent of the GUI calling 
 this function.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [p] = gui_updateparent(UserData,focus)
0002 
0003 % gui_updateparent - General GUI data handing for EEG Toolbox
0004 %
0005 % Usage: [p] = gui_updateparent(UserData,focus)
0006 %
0007 % 'UserData' is obtained from get(gcbf,'UserData'), where all
0008 % the necessary parameters and stored for each GUI, including
0009 % the handles of any GUI parent.
0010 %
0011 % 'focus' is a boolean option that switches whether the
0012 % parent is the current figure (1, default) or not (0).
0013 %
0014 % This function returns the p struct to both the matlab
0015 % workspace and any direct parent of the GUI calling
0016 % this function.
0017 %
0018 
0019 % $Revision: 1.1 $ $Date: 2004/11/12 01:32:35 $
0020 
0021 % Licence:  GNU GPL, no express or implied warranties
0022 % History:  04/2002, Darren.Weber_at_radiology.ucsf.edu
0023 %                    - extracted from individual gui* functions
0024 %
0025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0026 
0027 if ~exist('focus','var'), focus = 1; end
0028 
0029 if isfield(UserData,'parent'),
0030     if isfield(UserData.parent,'gui'),
0031         % Get the userdata from the parent
0032         parent = get(UserData.parent.gui,'UserData');
0033         if isfield(parent,'p') & isfield(UserData,'p'),
0034             % Update the parent p structure
0035             parent.p = UserData.p;
0036             set(UserData.parent.gui,'UserData',parent);
0037             % Make the parent the current figure
0038         end
0039         if focus,
0040             figure(UserData.parent.gui); end
0041     end
0042 end
0043 
0044 if isfield(UserData,'p'),
0045     if ~isempty(UserData.p),
0046        [p] = UserData.p;
0047     end
0048 end
0049 
0050 return

Generated on Mon 15-Aug-2005 15:36:19 by m2html © 2003