Icon not appearing in app

36 views (last 30 days)
Peter
Peter on 10 Apr 2024
Answered: Peter on 1 May 2024
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 Comments
Peter
Peter on 10 Apr 2024
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 on 11 Apr 2024
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.

Sign in to comment.

Accepted Answer

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

More Answers (2)

prabhat kumar sharma
prabhat kumar sharma on 14 Apr 2024
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 Comment
Peter
Peter on 15 Apr 2024
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.

Sign in to comment.


Peter
Peter on 1 May 2024
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.

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Products


Release

R2024a

Community Treasure Hunt

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

Start Hunting!