Icon not appearing in app

27 次查看(过去 30 天)
Peter
Peter 2024-4-10
回答: Peter 2024-5-1
Hi,
I am creating an app (for the first time) and the following is just a demo. I have defined an icon which appears in the button as you can see below. I'm also expecting it to appear on the top banner. I'm assuming that's what the settings were for.
App appearance
App body
CatedemoUIFigure settings
Settings
Code snippet for creation
% Component initialization
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Get the file path for locating images
pathToMLAPP = fileparts(mfilename('fullpath'));
% Create CatedemoUIFigure and hide until all components are created
app.CatedemoUIFigure = uifigure('Visible', 'off');
app.CatedemoUIFigure.Position = [100 100 161 322];
app.CatedemoUIFigure.Name = 'Cate demo';
app.CatedemoUIFigure.Icon = fullfile(pathToMLAPP, 'cellxica.png');
app.CatedemoUIFigure.Tag = 'icon';
Code snippet after all components are created
% Show the figure after all components are created
app.CatedemoUIFigure.Visible = 'on';
Thank you.
  3 个评论
Peter
Peter 2024-4-10
Thank you for the reply.
The png is OK as it renders in the button.
It's definately in the same folder.
The path is included by the app designer and it is immutable.
% Get the file path for locating images
pathToMLAPP = fileparts(mfilename('fullpath'));
The top if the app only has the title and a close button. I was expecting a minimize and maximize too. Perhaps the place holder for the image is missing so it has nowhere to render it to?
Peter
Peter 2024-4-11
It appears that I have misinterpreted which icon this is. It does apper as the image when doing Alt-Tab, switching between applications.
Every day is a school day.

请先登录,再进行评论。

采纳的回答

Peter
Peter 2024-4-11
The icon is for displaying with Alt-Tab.

更多回答(2 个)

prabhat kumar sharma
Hi Peter,
If you'd like the same icon to appear in the top banner as well, you'll need to set the Icon property within the Identifier section of app.UIFigure.
Hope this helps!
  1 个评论
Peter
Peter 2024-4-15
Hi Prabhat,
Thank you for your reply. This is what I was expecting but only the applications icon is changed (e.g. alt-tab). The app designer does not give a minimise or maximise button on the top banner by default. There is a Matlab example...
f = msgbox("Operation Completed");
Which the demo should look like this...
Mine looks like this...
I'm using Matlab R2024a on Linux. The previous version did this too.
Thanks
Peter.

请先登录,再进行评论。


Peter
Peter 2024-5-1
In Ubuntu, I had to use gnome-tweaks to enable the minimise and maximise button. So I now get this in MATLAB and all other Ubuntu apps!
Still no icon on the left hand side.

类别

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

产品


版本

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by