Skip to content

Commit a25a46f

Browse files
authored
Merge pull request #146 from mathworks/141-for-app-classes-provide-an-alternative-to-the-setup_internal-method-for-code-to-run-pre-setup
add preSetup and postSetup methods to BaseApp for customizations
2 parents d001925 + f8abfe2 commit a25a46f

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

widgets/+wt/+apps/BaseApp.m

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,14 @@ function forceUpdate(app)
187187
% toolbar is added to the figure.
188188
app.Figure.Position = app.getPreference('Position',[100 100 1000 700]);
189189

190+
% Ensure it's on screen
191+
app.moveOnScreen();
192+
190193
% Set up components
191-
app.setup_internal();
192-
app.setup();
194+
app.preSetup(); % for pre-setup customization, like a splash screen
195+
app.setup_internal(); % sealed, for session subclasses
196+
app.setup(); % create the components
197+
app.postSetup(); % for post-setup customization
193198

194199
% Set any P-V pairs
195200
if ~isempty(remArgs)
@@ -463,6 +468,28 @@ function moveOnScreen(app)
463468

464469
%% Protected Methods
465470
methods (Access = protected)
471+
472+
function preSetup(~)
473+
% Customize behavior between figure creation and setup
474+
475+
% Format:
476+
% function preSetup(app)
477+
% % code here
478+
% end
479+
480+
end %function
481+
482+
483+
function postSetup(~)
484+
% Customize behavior between setup and update
485+
486+
% Format:
487+
% function postSetup(app)
488+
% % code here
489+
% end
490+
491+
end %function
492+
466493

467494
function displayDebugText(app, evt)
468495
% Display the path to the caller function in the command window

0 commit comments

Comments
 (0)