Custom subclass of App Designer Component doesn't show up

4 次查看(过去 30 天)
Hi,
When constructing a custom UI component whose class inherits an App-Designer-Components class, the constructed component doesn't show up.
I can't figure out why, any ideas?
Or maybe, App-Designer-Components class were initilally thought to be sealed?
Thank you very much! ;)
FZ
test script:
hf = uifigure();
hb = UIButtonSubClass('Parent', hf);
custom class:
classdef UIButtonSubClass < matlab.ui.control.Button
properties
additionalProperty
end
methods
function this = UIButtonSubClass(varargin)
% constructor
this = this@matlab.ui.control.Button(varargin{:});
this.additionalProperty = 'something';
end
end
end
R2019b
  1 个评论
Nicolas B.
Nicolas B. 2019-10-31
Looking to my test, MATLAB does not accept that a uifigure has a non-native MATLAB class as a children. So unfortunately, it's not possible to do what you want.
However, as alternative solution, you can freely use the property UserData of any MATLAB graphical class.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Develop Apps Using App Designer 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by