Porting a very old GUI to current versions and using the application compiler
6 views (last 30 days)
Show older comments
Under windows 7 and 10 I have a matlab GUI from 2009 that is in daily production use with folks running matlab from that era. I have managed to get it working under 2015B with as few interface changes as possible and just as I thought I was done, I've been asked to package it up using the application compiler to send to standalone users.
I'm not sure if my problem is with the application compiler or with the structure of the original gui.
The application compiler shows a splash screen and then stops. I think that it's performing correctly.
There are other files involved, but the GUI consists primarily of three files GUI.m, GUI.fig and GUI_CALLBACK.m. Many of the interface elements call a dispatching GUI_CALLBACK routine that uses a switch statement to get to the code of that element.
The GUI is currently running by clicking on the GUI.fig from explorer (or a shortcut to the fig file) Yes. I'll say that again. The GUI is currently run by clicking on the fig file from explorer. Running GUI.m from the command line does not invoke the gui.
Sans comments the entire contents of GUI.m is
function varargout = Grading_Gui(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Grading_Gui_OpeningFcn, ...
'gui_OutputFcn', @Grading_Gui_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
function Grading_Gui_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
guidata(hObject, handles);
function varargout = Grading_Gui_OutputFcn(hObject, eventdata, handles)
varargout{1} = handles.output;
I can mimic much of the functionality of the GUI with a new guide-built mimic where all of the callbacks will be in MIMIC.m and MIMIC.m will contain.
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
This mimic of the GUI will package up correctly using the application compiler.
Placing calls to gui_mainfcn in GUI.m creates a world of confusion when the m file is called. Trying to extract the callbacks from GUI_CALLBACK.m and create new guide inspired version in GUI.m doesn't succeed.
Any ideas on how the fig file is running the m files?
Any ideas on the best way to get an application compiled version of this w/out going back to the drawing board and recreating a fully new GUI that might behave subtly differently than the old version and end up being rejected by current users?
8 Comments
Walter Roberson
on 17 Jan 2016
In theory it could be done by modifying Grading_Gui_OpeningFcn or one of the other *OpeningFcn as those graphics objects come into existence and so have their CreateFcn callbacks executed when the .fig is openfig()'d
I have not investigated GUIDE extensively; I used it a small number of times a number of years ago, and I have poked at it from time to time to answer Questions here. Still, I might be able to figure out how the existing one works.
I am running R2014a so there is a possibility that it might just work for me without modification. Perhaps.
I suggest you .zip the files and attach it here. Or you could send me a link to the .zip through my profile here.
Answers (0)
See Also
Categories
Find more on Interactive Control and Callbacks in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!