@@ -177,7 +177,7 @@ function fontWeight(uiElement, weight)
177
177
% to the provided uifigure control.
178
178
% Get a handle to the webwindow
179
179
win = mlapptools .getWebWindow(uiElement );
180
- mlapptools .waitTillWebwindowLoaded(win );
180
+ mlapptools .waitTillWebwindowLoaded(win , ancestor( uiElement , ' matlab.ui.Figure ' ) );
181
181
182
182
% Find which element of the DOM we want to edit
183
183
switch uiElement .Type
@@ -616,8 +616,12 @@ function unlockUIFig(hUIFig)
616
616
end % getWidgetIDFromDijit
617
617
618
618
function to = getTimeout(hFig )
619
- to = getappdata(hFig , mlapptools .TAG_TIMEOUT );
620
- if isempty(to ), to = mlapptools .QUERY_TIMEOUT ; end
619
+ if isempty(hFig ) || ~isa(hFig , ' matlab.ui.Figure' )
620
+ to = mlapptools .QUERY_TIMEOUT ;
621
+ else
622
+ to = getappdata(hFig , mlapptools .TAG_TIMEOUT );
623
+ if isempty(to ), to = mlapptools .QUERY_TIMEOUT ; end
624
+ end
621
625
end % getTimeout
622
626
623
627
function tf = isUIFigure(hList )
@@ -722,11 +726,14 @@ function waitTillFigureLoaded(hFig)
722
726
723
727
function waitTillWebwindowLoaded(hWebwindow , hFig )
724
728
% A blocking method that ensures a certain webwindow has fully loaded.
725
- if nargin < 2
726
- hFig = mlapptools .figFromWebwindow(hWebwindow );
729
+ try
730
+ if nargin < 2
731
+ hFig = mlapptools .figFromWebwindow(hWebwindow );
732
+ end
733
+ to = mlapptools .getTimeout(hFig );
734
+ catch % possible workaround for R2017a:
735
+ to = mlapptools .getTimeout([]);
727
736
end
728
-
729
- to = mlapptools .getTimeout(hFig );
730
737
tic
731
738
while (toc < to ) && ~jsondecode(hWebwindow .executeJS(...
732
739
' this.hasOwnProperty("require") && require !== undefined && typeof(require) === "function"' ))
0 commit comments