Einzelnen Beitrag anzeigen

Benutzerbild von Helmi
Helmi

Registriert seit: 29. Dez 2003
Ort: Erding, Republik Bayern
3.312 Beiträge
 
Delphi XE2 Professional
 
#1

Komponente: Problem mit 2x Aufruf einer Procedure + Variable

  Alt 27. Dez 2004, 14:34
Hallo,

sorry wegen dem etwas komischen Titel - aber ich weiss nicht wie man es am besten nenen soll.

Also mein Problem:

Ich hab folgendes:
Code:
type
  TBalloonTipFlags = (BT_Info, BT_Warning, BT_Error, BT_WinSymbol, BT_Question, BT_FormIcon, BT_Custom);

private
  FBalloonTipFlags: TBalloonTipFlags;

published
  property BalloonTipFlags: TBalloonTipFlags read FBalloonTipFlags
    write SetBalloonTipFlag default BT_Info;

{ ... }

procedure TTrayIcon.SetBalloonTipFlag(Value : TBalloonTipFlags);
begin
  //Wird aufgerufen wenn sich die Variable "FBalloonTipFlags" ändert
  FBalloonTipFlags := Value;

  DoBalloonTipFlags;
end;

procedure TTrayIcon.DoBalloonTipFlags;
begin
  //Flags
  case FBalloonTipFlags of
    //Info
    BT_Info      : FFlagImage.Picture.Icon.Handle := LoadIcon(0, IDI_ASTERISK);

    //Warnung
    BT_Warning   : FFlagImage.Picture.Icon.Handle := LoadIcon(0, IDI_EXCLAMATION);

    //Fehler
    BT_Error     : FFlagImage.Picture.Icon.Handle := LoadIcon(0, IDI_HAND);

    //Windows-Symbol
    BT_WinSymbol : FFlagImage.Picture.Icon.Handle := LoadIcon(0, IDI_WINLOGO);

    //Frage
    BT_Question  : FFlagImage.Picture.Icon.Handle := LoadIcon(0, IDI_QUESTION);

    //Form-Icon
    BT_FormIcon  : FFlagImage.Picture.Icon        := Application.Icon;

    //Eigenes Icon
    BT_Custom    : begin
                      FFlagImage.Picture             := FCustomFlagPicture;
                      showmessage('BT_Custom');
                    end;
  end;
Wenn ich nun das Flag: BT_Custom auswähle dann sehe ich die Meldung.

Wenn ich aber jetzt über eine Property ein TPicture auswähle dann wird folgende Procedure ausgeführt:
Code:
procedure TTrayIcon.SetCustomFlagPicture(Value: TPicture);
begin
  //Wird aufgerufen, wenn sich die Variable "FCustomFlagPicture" ändert
  FCustomFlagPicture.Assign(Value);
  DoBalloonTipFlags;
end;
Nur bei diesem Code wird die Message in der Procedure "DoBalloonTipFlags" nicht angezeigt, ob (meines Vermutens) die Variable "FBalloonTipFlags" immer noch den Wert "BT_Custom" haben müsste, oder?

Was ist daran verkehrt, dass ich beim zweiten mal die Message (die ja nur als test dient) nicht sehe?

mfg
Helmi
  Mit Zitat antworten Zitat