StackOverflowMATLABchat / mlapptools

MATLAB class containing methods for programmatic uifigure modification
http://undocumentedmatlab.com/blog/customizing-uifigures-part-2
MIT License
25 stars 11 forks source link

getWidgetList() inconsistent output in R2018a #17

Closed Dev-iL closed 6 years ago

Dev-iL commented 6 years ago

The transition from R2017b to R2018a caused some functionality to break. For example, running TableDemo and pressing the button now yields the following error:

Error using matlab.internal.webwindow/executeJS (line 730)
Error executing JavaScript command:

    JavaScript error: Uncaught TypeError: Cannot read property 'style' of null at line 111 column 385 in
    https://localhost:31515/toolbox/matlab/uitools/uifigureappjs/release/dojo/dojo.js

Error in mlapptools.setStyle (line 279)
              win.executeJS(styleSetStr);

Error in TableDemo/ButtonPushed (line 27)
            mlapptools.setStyle(...

Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 309)
Error while evaluating Button PrivateButtonPushedFcn.

If we run on R2017b and R2018a the following code:

T = TableDemo;
H = mlapptools.getHTML(T.UIFigure);

We get the two results R2017b.html and R2018a.html. On first glance the files have different length - 31710 and 32039 chars (before formatting), respectively.

Although DIFFing these files reveals some noteworthy changes,

...they unfortunately do not explain the source of the issue.

mlapptools.aboutJSLibs() returns the same exact output in both versions, so a library version change is also not to blame.

When debugging TableDemo>ButtonPushed, we can see that the widget list w filtered from the registry is 1 element longer in R2018a (although as we recall, the HTML is missing a certain widget div), which itself should not be a problem, but this additional widget cannot be found by dojo.query, which leads to an error later on when evaluating dojo.style.

I don't know if it's worth investigating the deeper reason here, but surely the demo could be fixed to perform better filtering and not return this problematic result...