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