![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1823234/image.png)
CustomDisplay functionality for AppDesigner apps
17 ビュー (過去 30 日間)
古いコメントを表示
I'm developing an AppDesigner App that I intend to interact with from the console. Right now, when I display my app at the console, my custom members get buried under all the public handles as shown below:
>> hApp
hApp =
MyApp with properties:
UIFigure: [1×1 Figure]
FileMenu: [1×1 Menu]
OpenMenu: [1×1 Menu]
SaveMenu: [1×1 Menu]
... % Many more handles omitted for brevity % ...
foo: 0
bar: [1x1 struct]
baz: [1x1 struct]
I'm trying to achieve something similar to this, where the least useful public members are hidden in the properties link:
>> hApp.UIFigure
ans =
Figure (MyApp) with properties:
Number: []
Name: 'MyApp'
Color: [940.0000e-003 940.0000e-003 940.0000e-003]
Position: [2.1360e+003 -663.0000e+000 640.0000e+000 480.0000e+000]
Units: 'pixels'
Show all properties
The Figure class can easily achieve this due to inheritance from matlab.mixin.CustomDisplay. However, AFAIK, it is not possible to edit the inheritance of AppDesigner apps.
How do I hide visibility of particular members without reinventing the wheel?
0 件のコメント
回答 (2 件)
Pratyush Swain
2025 年 1 月 13 日
Hi Anthony,
I do not think the AppDesigner framework allows editing the inheritance structure of apps. As a workaround, when you have too many public handles, consider grouping your custom properties into a struct.
Please refer to this following workflow:
1 - Define a property to contain the custom components
properties (Access = public)
myprops struct % Group all custom components here
end
2 - Define a function where you will group the components
The idea is you should add all your custom components here -
function initializeProps(app)
app.myprops = struct();
% Group custom components into a struct
app.myprops.baz = app.baz;
app.myprops.bar = app.bar;
app.myprops.foo = app.foo;
end
3 - Call the function
Add a callback function to the main app component (from the design view) - name it as appStartup(), call the grouping function inside this.
initializeProps(app);
Finally you can view the custom components like this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1823234/image.png)
I have also attached a sample mlapp file for your reference.
Let me know if this helps.
Githin George
2025 年 1 月 21 日 11:09
Another workaround I would suggest is to Export your App outside of App Designer and modify the inheritance rule. Multiple Inheritance seems to be working well for this use case and you can override the functions as you would for a Figure object.
参考
カテゴリ
Help Center および File 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!