Lazarus

Programming => Graphics and Multimedia => Graphics => Topic started by: winni on August 12, 2020, 11:02:14 pm

Title: Icon not refreshing
Post by: winni on August 12, 2020, 11:02:14 pm
Hi!

I made an Icon 256x256.
Put it into the project via project --> options --> icon

Compiled, the icon was shown in the taskbar adn the titlebar - eveything is fine.

The icon was not impressive enough so I made some changes.
Then again the same way as above.
New compiler run - but the new version of the icon is not shown,
but everywhere the old version of the icon.

?????

I have no idea what or where to refresh.
Any ideas or hints??

Winni

Title: Re: Icon not refreshing
Post by: Blaazen on August 12, 2020, 11:21:55 pm
Try Run->Clean Up and Build...
Title: Re: Icon not refreshing
Post by: winni on August 12, 2020, 11:38:57 pm
Thanx Blaazen -

I did that already but did not write it.
It has no effect.

???

Winni
Title: Re: Icon not refreshing
Post by: trev on August 13, 2020, 01:43:04 am
@Winni: operating system?
Title: Re: Icon not refreshing
Post by: winni on August 13, 2020, 02:16:35 am
Hi!

Sorry - I was so bothered that I forgot :

Lin64 Suse Tumbleweed KDE, fpc 3.04, Lazarus 2.010

The things become more strange.

I tried a lot of different things.
Inbetween I deleted the Icon and replaced it with the default Icon - the paw.

Perfect . Taskbar and Titlebar show the paw.

Then I deleted the paw and replaced it with the new version of the icon .
Now I get mad: The Taskbar shows the OLD version of the icon .

????

A nice way to bring people in the mental hospital ....

Winni

PS : The KDE icon cash ???
Title: Re: Icon not refreshing
Post by: winni on August 13, 2020, 02:30:32 am
Hi!

Thanx everybody!

Another KDE bug:
Delete the KDE icon cache  and the problem is solved:

Code: Bash  [Select][+][-]
  1. cd /home/winni/.cache
  2. rm icon-cache.kcache
  3.  

Winni
Title: Re: Icon not refreshing
Post by: lainz on August 16, 2020, 07:15:29 pm
The same happens on Windows sometimes. So it's a cross platform bug.
Title: Re: Icon not refreshing
Post by: trev on August 17, 2020, 12:21:29 am
Same thing happens under macOS where the solutions are many, but the quickest is to touch (Unix command) the app bundle directory. Finder caches the icons. Not sure it's a bug as such.
Title: Re: Icon not refreshing
Post by: winni on August 17, 2020, 12:40:52 am
@trev

Nice trick. Should work with Unix/Linux.

But that could be done by Lazarus.

Or do it yourself with fileSetDate.

Winni
Title: Re: Icon not refreshing
Post by: lazimiri on August 25, 2020, 05:29:18 pm
The same happens on Windows sometimes. So it's a cross platform bug.

I agree with you.
Title: Re: Icon not refreshing
Post by: winni on August 25, 2020, 05:43:01 pm
Hi!

So we need a workaround.
I assume that the NewIcon is of the same size as the Form1.Icon:

Code: Pascal  [Select][+][-]
  1. var
  2. NewIcon: TIcon;
  3. R : TRect;
  4. ......
  5. with Form1 do
  6.   begin
  7.     R := Rect (0,0,Icon.width,Icon.height);
  8.     icon.canvas.CopyRect(R,NewIcon.canvas,R);  
  9.   end;
  10. NewIcon.free;
  11. ....

The NewIcon is shown at once in the taskbar .

But the problem must be somewhere in the code for cashing.
I don't know where to start searching .

Winni
Title: Re: Icon not refreshing
Post by: trev on August 26, 2020, 03:17:44 am
The icons that Windows uses for programs are saved in an icon cache, so they can be displayed quickly instead of having to slowly load them every time.

I would imagine the Windows solution is to rebuild the icon cache. I'm sure I've done that in the long distant past... back when I was using Windows 2000 on a PC.
Title: Re: Icon not refreshing
Post by: winni on August 28, 2020, 09:57:47 pm
The icons that Windows uses for programs are saved in an icon cache, so they can be displayed quickly instead of having to slowly load them every time.

I would imagine the Windows solution is to rebuild the icon cache. I'm sure I've done that in the long distant past... back when I was using Windows 2000 on a PC.

Hi!

Yes it seems that there is no checking in the different cache files if there could something be deleted.
So the cache grows all the time and contains ancient files.

As you talk about Win2000 I just remembered that we once had a big problem with the font cache of Win95:
The maximum then was 64k and if you installed a new font and had reached the font cache limit the font did not appear.
Solution: Delete some unused fonts, delete the font cache and reboot.

Perhaps also here is the solution to delete the icon cache. Will be rebuild after the next reboot.

Winni
Title: Re: Icon not refreshing
Post by: trev on August 29, 2020, 04:57:30 am
See this article (https://www.thewindowsclub.com/rebuild-icon-clear-thumbnail-cache-windows-10) which deals with the different ways to rebuild the icon cache under Windows 7/8, 8.1 and 10. Yes, they have to be different   >:(
Title: Re: Icon not refreshing
Post by: lazimiri on September 14, 2020, 07:44:10 am
The article is working really well. It helped me with my icons. Thanks!
TinyPortal © 2005-2018