diff --git a/mlapptools.m b/mlapptools.m index 33c7cac..61c3fa2 100644 --- a/mlapptools.m +++ b/mlapptools.m @@ -98,7 +98,11 @@ function fontWeight(uiElement, weight) % A method for obtaining the webwindow handle and the widgetID corresponding % to the provided uifigure control. % Get a handle to the webwindow - win = mlapptools.getWebWindow(uiElement.Parent); + p = uiElement.Parent; + while ~isa(p,'matlab.ui.Figure') + p = p.Parent; + end + win = mlapptools.getWebWindow(p); % Find which element of the DOM we want to edit widgetID = mlapptools.getWidgetID(win, mlapptools.getDataTag(uiElement));