GUI in a package

7 次查看(过去 30 天)
Daniel Rohrbach
Daniel Rohrbach 2012-1-16
Hi,
I have a small problem. I try to organize my code using the packaging system of Matlab. For this I also tried include my guys. For me it seems to be that this is not fully supported by Matlab yet.
I'm using Matlab R2011a
The first Thing:
  • Automatically created Callbacks (for buttons, …) in the property inspector must be adapted for the package system:
pss.setup.gui.pss_setup('PMLwi_Callback',hObject,eventdata,guidata(hObject))
where pss_setup is the gui
  • Then I have to provide for the gui_State struct in the header of the gui-m-file the full class path to the gui:
gui_State = struct('gui_Name', [ mt.file.FileTools.getClassPath( 'pss.setup.gui.pss_setup' ) 'pss_setup'], ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @pss_setup_OpeningFcn, ...
'gui_OutputFcn', @pss_setup_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
Where mt.file.FileTools.getClassPath is a own written function which returns the full path(including package folder) to the gui figure file.
The Big issue:
  • If I have a singleton gui G1 (package pss.setup.gui ) and if there are other singleton guis (G2 - Gx) opened which are under the same package root ( +pss ) folder but different guis it opens one of these (I guess the last one (Gx) ) instead of G1.
I checked the openfig Function and it seems that it looks for guis that are opened. If they have the same root package folder (in my case pss) the function identifies them all to be the same.
  • I.e: to guis are opened which are singletons:
p1.p2.G1.fig % gui 1 in package p1.p2 named G1.fig
p1.p3.G2.fig % gui 2 in package p1.p3 named G2.fig
will be identified by the openfig function to be the same.

回答(1 个)

Walter Roberson
Walter Roberson 2012-1-16
Automatically created Callbacks are for GUIDE, and GUIDE is not intended to be used with the package system.

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by