Icon not appearing in app

29 Ansichten (letzte 30 Tage)
Peter
Peter am 10 Apr. 2024
Beantwortet: Peter am 1 Mai 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 Kommentare
Peter
Peter am 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 am 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.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

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

Weitere Antworten (2)

prabhat kumar sharma
prabhat kumar sharma am 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 Kommentar
Peter
Peter am 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.

Melden Sie sich an, um zu kommentieren.


Peter
Peter am 1 Mai 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.

Kategorien

Mehr zu Develop Apps Using App Designer finden Sie in Help Center und File Exchange

Produkte


Version

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by