I have an application converted from GUIDE to App Designer. It uses an external library that performs various calculations and data is passed back and forth. In the app a 3D model is displayed on UIAxes and there is a callback function that uses camlight to move the lighting as you rotate the model. As the object is moved the lights are repositioned, and the rotation property is re-enabled. Among other typical UI objects in the app, there is a listbox with a context menu that is used to run various functions based on the options selected in the listbox.
When I open the context menu on the listbox and rotate3d has been enabled using r.Enable = 'on' in the code or by clicking the rotation icon on the figure, the following error is generated:
Error in executing callback registered with ViewModel: Event 'ContextMenuOpening' is not defined for class 'matlab.graphics.GraphicsPlaceholder'
It seems that using the rotate3d object to enable various options causes the problem:
r = rotate3d(app.UIAxes);
r.ActionPostCallback = {@app.mycallback, app};
I'm not sure why, but using the function this way doesn't generate the error message.
rotate3d(app.UIAxes, "on")
However, I want to use the ActionPostCallback property. Why might the rotate3d object cause this error when opening the context menu?
I believe I've reduced the error down to the minimum pieces causing the problem and have a working example attached.
Steps to reproduce:
- With line 31 commented out and lines 35-37 uncommented, run the application
- Right click on the listbox to generate the error
- Go back to code, comment out lines 35-37, uncomment line 31, and rerun the application
- Right click on the listbox and see that no error is generated
Note: you can invoke the callback function in step 2 by rotating the figure.
Thanks for any help