Skip to content

Commit 39c30b7

Browse files
committed
Rearranged switch/case inside getWebWindow
1 parent c18d8e9 commit 39c30b7

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

mlapptools.m

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,11 @@ case verLessThan('matlab','9.7') % R2019a
353353

354354
hController = struct(struct(hUIFig).Controller);
355355
% Check for Controller version:
356-
switch subsref(ver('matlab'), substruct('.','Version'))
357-
case {'9.0','9.1'} % R2016a or R2016b
356+
switch true
357+
case verLessThan('matlab','9.0') % <= R2015b
358+
throw(MException('getWebWindow:MATLABTooOld',...
359+
'MATLAB versions before R2016a are not supported!'));
360+
case verLessThan('matlab','9.2') % R2016a or R2016b (i.e., 9.0-9.1)
358361
hWin = hController.Container.CEF;
359362
otherwise % R2017a onward
360363
hWin = struct(hController.PlatformHost).CEF;
@@ -701,13 +704,16 @@ function unlockUIFig(hUIFig)
701704
warning(warnState);
702705
end % getDataTag
703706

704-
function [widgetID] = getDecendentOfType(hWin, ancestorDataTag, descendentType)
707+
function [widgetID] = getDecendentOfType(hWin, ancestorDataTag, descendentType, descId)
705708
% This method returns a node's first descendent of a specified <type>.
706709
% See also:
707710
% https://dojotoolkit.org/reference-guide/1.10/dojo/query.html#standard-css2-selectors
711+
if nargin < 4
712+
descId = 0;
713+
end
708714
widgetquerystr = sprintf(...
709-
'dojo.getAttr(dojo.query("[data-tag^=''%s''] %s")[0], "%s")', ...
710-
ancestorDataTag, descendentType, mlapptools.DEF_ID_ATTRIBUTE);
715+
'dojo.getAttr(dojo.query("[data-tag^=''%s''] %s")[%u], "%s")', ...
716+
ancestorDataTag, descendentType, descId, mlapptools.DEF_ID_ATTRIBUTE);
711717
try % should work for most UI objects
712718
ID = hWin.executeJS(widgetquerystr);
713719
if ~strcmpi(ID,'null')

0 commit comments

Comments
 (0)