|
Hello,
I have one main GUI and one secondary GUI that is created upon pushing a button on the main. The secondary GUI has hardware drivers tied to it that don't play very nicely with MATLAB, so I would like to control when it can be closed.
I have commented out the line that closes the figure in CloseRequestFcn. Unfortunately, this tiny change dictates any attempt to close the figure in any way (command window, other functions, etc).
Is it possible to control how/when CloseRequestFcn closes its respective figure?
As a way around this I was thinking about calling the secondary GUI with an input such as:
handles.MyFun = MyFun(1); %first call
Then in the CloseRequestFcn, I could have a switch/case that will only close the figure if the input is, say, a 2.
handles.MyFun = MyFun(2); %call that ensures handles.MyFun are most recent
The only problem is that I have no idea how to declare inputs with a GUIDE generated GUI. Does anyone know how to manipulate the varargin code to pass inputs into the GUI? I know the initialization code says "DO NOT EDIT", but it is just so tempting.
function varargout = MyFun_videoFeed(varargin)
%Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @MyFun_videoFeed_OpeningFcn, ...
'gui_OutputFcn', @MyFun_videoFeed_OutputFcn, ...
'gui_LayoutFcn', [], ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
end
Thanks,
Maxx
|