Icon not appearing in app

36 ビュー (過去 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
prabhat kumar sharma 2024 年 4 月 14 日
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 Center および File ExchangeDevelop 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