Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi TJvTrayIcon aktualisieren (https://www.delphipraxis.net/46172-tjvtrayicon-aktualisieren.html)

CReber 19. Mai 2005 23:09


TJvTrayIcon aktualisieren
 
Bisheriger Code:

Delphi-Quellcode:
if (bActive) then
    Tray.IconIndex := 0
  else
    Tray.IconIndex := 1;
Im Entwicklungsmodus funktioniert das aktualisieren des Icons, aber während der Laufzeit nicht. Es wäre ja theoretisch einfach ShellNotifyIcon aber wie setze ich das ein bzw. was mache ich falsch ;)

Ultimator 19. Mai 2005 23:12

Re: TJvTrayIcon aktualisieren
 
Probier mal ein Sendmessage mit WM_PAINT :gruebel:

CReber 19. Mai 2005 23:22

Re: TJvTrayIcon aktualisieren
 
Hier noch ein Auszug aus dem Quellcode:

1. Schritt

Delphi-Quellcode:
procedure TJvTrayIcon.SetIconIndex(const Value: Integer);
begin
  if FIconIndex <> Value then begin
    FIconIndex := Value;
    IconPropertyChanged;
  end;
2. Schritt

Delphi-Quellcode:
procedure TJvTrayIcon.SetCurrentIcon(Value: TIcon);
begin
  FCurrentIcon.Assign(Value);
  FIconData.hIcon := FCurrentIcon.Handle;
  if tisTrayIconVisible in FState then
    //    if FIconData.hIcon = 0 then
    //      HideTrayIcon
    //    else
    NotifyIcon(NIF_ICON, NIM_MODIFY);
end;
Delphi-Quellcode:
procedure TJvTrayIcon.IconPropertyChanged;
var
  Ico: TIcon;
begin
  if not (csLoading in ComponentState) then
  begin
    if (FIcons <> nil) and (FIconIndex >= 0) and (FIconIndex < FIcons.Count) then
    begin
      Ico := TIcon.Create;
      try
        FIcons.GetIcon(FIconIndex, Ico);
        SetCurrentIcon(Ico);
      finally
        Ico.Free;
      end;
    end
    else
    if Assigned(Icon) and (not Icon.Empty) then
      SetCurrentIcon(Icon)
    else
      SetCurrentIcon(Application.Icon);
  end;
end;

Vielleicht sieht das ja jemand raus, weil ich sehe es nicht ;)

CReber 19. Mai 2005 23:24

Re: TJvTrayIcon aktualisieren
 
Ah ich bin ein Dussel... Die Bedingung war falsch


Sorry, ist schon spät ;) Kann geschlossen werden....


Alle Zeitangaben in WEZ +1. Es ist jetzt 07:17 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz