bugfix for guide
This commit is contained in:
@@ -2,8 +2,9 @@ function varargout = EDFMSimulatorGuide(varargin)
|
||||
%EDFMSIMULATORGUIDE GUIDE-compatible EDFM simulator GUI for MATLAB R2022a.
|
||||
% APP = EDFMSIMULATORGUIDE launches the converted GUIDE/uicontrol version
|
||||
% of the App Designer interface. The UI is built from standard figure,
|
||||
% uitabgroup, uicontrol, uitable and axes objects so it can be inspected and
|
||||
% adjusted with GUIDE-era tools in MATLAB R2022a.
|
||||
% uipanel, uicontrol, uitable and axes objects so it can be inspected and
|
||||
% adjusted with GUIDE-era tools in MATLAB R2022a. GUIDE does not support
|
||||
% uitabgroup, so pages are implemented as switchable uipanel containers.
|
||||
|
||||
if nargin > 0 && ischar(varargin{1})
|
||||
feval(varargin{:});
|
||||
@@ -19,6 +20,7 @@ handles.App = app;
|
||||
guidata(fig, handles);
|
||||
configureGuideCallbacks(app, fig);
|
||||
app.Controller.startup();
|
||||
set(fig, 'Visible', 'on');
|
||||
|
||||
if nargout > 0
|
||||
varargout{1} = app;
|
||||
@@ -37,6 +39,15 @@ end
|
||||
end
|
||||
|
||||
function configureGuideCallbacks(app, fig)
|
||||
if isprop(app, 'PageDropDown')
|
||||
app.PageDropDown.ValueChangedFcn = @(src, event) onMainPageChanged(fig);
|
||||
end
|
||||
if isprop(app, 'DiscretizationPageDropDown')
|
||||
app.DiscretizationPageDropDown.ValueChangedFcn = @(src, event) onDiscretizationPageChanged(fig);
|
||||
end
|
||||
if isprop(app, 'FlowPageDropDown')
|
||||
app.FlowPageDropDown.ValueChangedFcn = @(src, event) onFlowPageChanged(fig);
|
||||
end
|
||||
app.NewConfigButton.ButtonPushedFcn = @(src, event) onNewConfig(fig);
|
||||
app.LoadTemplateButton.ButtonPushedFcn = @(src, event) onLoadTemplate(fig);
|
||||
app.ImportConfigButton.ButtonPushedFcn = @(src, event) onImportConfig(fig);
|
||||
@@ -68,6 +79,43 @@ app.FractureWellLocationTable.CellSelectionCallback = @(src, event) onTableSelec
|
||||
app.ScheduleTable.CellSelectionCallback = @(src, event) onTableSelection(fig, 'ScheduleTable', event);
|
||||
end
|
||||
|
||||
function onMainPageChanged(fig)
|
||||
handles = guidata(fig);
|
||||
pageTags = {'ModelTab', 'GridTab', 'FractureTab', 'DiscretizationTab', ...
|
||||
'FlowTab', 'WellsTab', 'SolverRunTab', 'ResultsTab'};
|
||||
showSelectedPanel(handles, 'PageDropDown', pageTags);
|
||||
guidata(fig, handles);
|
||||
end
|
||||
|
||||
function onDiscretizationPageChanged(fig)
|
||||
handles = guidata(fig);
|
||||
showSelectedPanel(handles, 'DiscretizationPageDropDown', {'SPTab', 'DPTab'});
|
||||
guidata(fig, handles);
|
||||
end
|
||||
|
||||
function onFlowPageChanged(fig)
|
||||
handles = guidata(fig);
|
||||
showSelectedPanel(handles, 'FlowPageDropDown', {'GasWaterTab', 'OilWaterTab', 'MultiComponentTab'});
|
||||
guidata(fig, handles);
|
||||
end
|
||||
|
||||
function showSelectedPanel(handles, selectorName, panelTags)
|
||||
if ~isfield(handles, selectorName)
|
||||
return;
|
||||
end
|
||||
selectedIndex = get(handles.(selectorName), 'Value');
|
||||
selectedIndex = min(max(1, selectedIndex), numel(panelTags));
|
||||
for i = 1:numel(panelTags)
|
||||
if isfield(handles, panelTags{i}) && isgraphics(handles.(panelTags{i}))
|
||||
if i == selectedIndex
|
||||
set(handles.(panelTags{i}), 'Visible', 'on');
|
||||
else
|
||||
set(handles.(panelTags{i}), 'Visible', 'off');
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function app = getGuideApp(fig)
|
||||
handles = guidata(fig);
|
||||
app = handles.App;
|
||||
|
||||
Reference in New Issue
Block a user