Recent

Author Topic: Icon not refreshing  (Read 3627 times)

winni

  • Hero Member
  • *****
  • Posts: 3197
Icon not refreshing
« 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


Blaazen

  • Hero Member
  • *****
  • Posts: 3237
  • POKE 54296,15
    • Eye-Candy Controls
Re: Icon not refreshing
« Reply #1 on: August 12, 2020, 11:21:55 pm »
Try Run->Clean Up and Build...
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Icon not refreshing
« Reply #2 on: August 12, 2020, 11:38:57 pm »
Thanx Blaazen -

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

???

Winni

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: Icon not refreshing
« Reply #3 on: August 13, 2020, 01:43:04 am »
@Winni: operating system?

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Icon not refreshing
« Reply #4 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 ???

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Icon not refreshing
« Reply #5 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

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: Icon not refreshing
« Reply #6 on: August 16, 2020, 07:15:29 pm »
The same happens on Windows sometimes. So it's a cross platform bug.

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: Icon not refreshing
« Reply #7 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.

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Icon not refreshing
« Reply #8 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

lazimiri

  • New member
  • *
  • Posts: 7
Re: Icon not refreshing
« Reply #9 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.

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Icon not refreshing
« Reply #10 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
« Last Edit: August 25, 2020, 05:45:24 pm by winni »

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: Icon not refreshing
« Reply #11 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.

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Icon not refreshing
« Reply #12 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

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: Icon not refreshing
« Reply #13 on: August 29, 2020, 04:57:30 am »
See this article 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   >:(

lazimiri

  • New member
  • *
  • Posts: 7
Re: Icon not refreshing
« Reply #14 on: September 14, 2020, 07:44:10 am »
The article is working really well. It helped me with my icons. Thanks!

 

TinyPortal © 2005-2018