Skip to content

Commit 88b82f6

Browse files
committed
Add check for parent UI Figure
Previous logic assumed that the parent of the input UI object is the UI Figure, which is an incorrect assumption. Other containers, like uipanel, exist and are valid parents for other UI objects but will cause the object type check to fail. This type check has been updated to utilize ancestor to obtain the parent figure window. See #6
1 parent f86cace commit 88b82f6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mlapptools.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,12 @@ function fontWeight(uiElement, weight)
104104
widgetID = mlapptools.getWidgetID(win, mlapptools.getDataTag(uiElement));
105105
end % getWebElements
106106

107-
function [win] = getWebWindow(hUIFig)
107+
function [win] = getWebWindow(hUIObj)
108108
warnState = mlapptools.toggleWarnings('off');
109109
% Make sure we got a valid handle
110+
% Check to make sure we're addressing the parent figure window,
111+
% catches the case where the parent is a UIPanel or similar
112+
hUIFig = ancestor(hUIObj, 'figure');
110113
assert(mlapptools.isUIFigure(hUIFig),...
111114
'mlapptools:getWebWindow:NotUIFigure',...
112115
'The provided window handle is not of a UIFigure.');

0 commit comments

Comments
 (0)