Skip to content

Commit 0f9a240

Browse files
committed
fixes to BaseInternalDialog and BaseExternalDialog
1 parent 2476a85 commit 0f9a240

File tree

2 files changed

+31
-5
lines changed

2 files changed

+31
-5
lines changed

widgets/+wt/+abstract/BaseExternalDialog.m

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,14 @@ function setup(obj)
412412
end %function
413413

414414

415+
function postSetup(obj)
416+
417+
% Update modal image now
418+
obj.updateModalImage();
419+
420+
end %function
421+
422+
415423
function update(~)
416424

417425

widgets/+wt/+abstract/BaseInternalDialog.m

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
end
4848

4949
function value = get.Title(obj)
50-
value = obj.OuterPanel.Title;
50+
value = string(obj.OuterPanel.Title);
5151
end
5252
function set.Title(obj, value)
5353
obj.OuterPanel.Title = value;
@@ -384,7 +384,7 @@ function setup(obj)
384384
warnState = warning('off','MATLAB:ui:components:noPositionSetWhenInLayoutContainer');
385385

386386
% Defaults
387-
obj.Position(3:4) = [350,200];
387+
obj.Position(3:4) = obj.Size;
388388

389389
% Restore warning
390390
warning(warnState)
@@ -473,6 +473,19 @@ function setup(obj)
473473
% Reposition the close button
474474
obj.repositionCloseButton();
475475

476+
% Position over figure by default
477+
if isscalar(obj.Figure) && isvalid(obj.Figure)
478+
obj.positionOver(obj.Figure)
479+
end
480+
481+
end %function
482+
483+
484+
function postSetup(obj)
485+
486+
% Update modal image now
487+
obj.updateModalImage();
488+
476489
end %function
477490

478491

@@ -549,6 +562,11 @@ function checkDeletionCriteria(obj)
549562
function updateModalImage(obj)
550563
% Triggered when the Modal property is changed
551564

565+
% Setup must be complete to run this code
566+
if ~obj.SetupFinished
567+
return
568+
end
569+
552570
% If toggled on, do the following
553571
if obj.Modal
554572

@@ -676,9 +694,6 @@ function onDialogButtonPushed(obj,evt)
676694
% The pushed button's Tag (or Name if Tag is empty) will be
677695
% set as the LastAction
678696

679-
% Request to assign output
680-
obj.assignOutput();
681-
682697
% What button was pushed?
683698
if isa(evt, "wt.eventdata.ButtonPushedData")
684699
% The lower dialog buttons (wt.ButtonGrid)
@@ -695,6 +710,9 @@ function onDialogButtonPushed(obj,evt)
695710
% Set last action
696711
obj.LastAction = action;
697712

713+
% Request to assign output
714+
obj.assignOutput();
715+
698716
% Prep event data
699717
evtOut = wt.eventdata.DialogButtonPushedData;
700718
evtOut.Action = obj.LastAction;

0 commit comments

Comments
 (0)