Why do I get 'Invalid superclass name' in WebControllerFactory when I attempt to create blank uifigure()?

5 ビュー (過去 30 日間)
The following error triggers about 100 times when I try to create a uifigure() in Matlab 2021b.
MathWorks::System::IUserException in WebControllerFactory::create(): [Error using matlab.ui.internal.componentframework.WebControllerFactory/checkPreconditions (line 45)
Invalid superclass name.
Error in matlab.ui.internal.componentframework.WebControllerFactory/create (line 92)
checkPreconditions( obj, component, parentController, nargin );]
Warning: Internal error creating figure controller.
Background:
I have code that modifies the DefaultFigureCreateFcn to keep track of when figures are created and destroyed. However, the above error will spam my command window at the beginning of a Matlab session when I attempt to execute my code. It only happens once per Matlab session. In order to reproduce it, I have to restart Matlab and run my code again. Running my code a second time during the same Matlab session does not reproduce the error.
Code Example:
set(0,'DefaultFigureCreateFcn','addlistener(gcf,''ObjectBeingDestroyed'',@(varargin) disp(1));')
hfig = uifigure()
Executing the above code during a fresh Matlab session will trigger the error about 100 times. If I rerun the code during the same session the error no longer occurs.
Any thoughts on why this is occurring? I did a little debugging and from what I can tell, the web controller is receiving a number of objects associated with a toolbar that are not of class web controller or component controller.
  2 件のコメント
Walter Roberson
Walter Roberson 2022 年 8 月 24 日
Does it make a difference if you configure the default as an anonymous function instead of a character vector?
Bryce
Bryce 2022 年 8 月 24 日
Yes! That fixes the issue! Thank you so much!!!

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop uifigure-Based Apps についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by