Autor Beitrag
Daniel L.
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 140
Erhaltene Danke: 14

W7, W8
TurboD Prof, Delphi Community
BeitragVerfasst: So 05.02.06 14:14 
Hallo,

Kann man eigentlich ein eigenes Ereigniss schreiben und auslösen, welches ausser TObject einen zusätzlichen Parameter mit übergibt?

bisher habe ich immer mit TNotifyEvent gearbeitet, da geht nur (Sender : TObject)

Danke _Daniel
Alstar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 827



BeitragVerfasst: So 05.02.06 14:28 
Erstelle doch einfach einen eigenen Prozedurtyp und nimm den dann als Event.
Kleines Bsp:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
type
  TErrorNotify = procedure(Sender: TObject; Error: Word) of object;

  TKlasse = class // irgendeine klasse
  private
    FErrorEvent: TErrorNotify;
  public
    property OnError: TErrorNotify read FErrorEvent write FErrorEvent; // Normalerweise Set und Get Prozeduren verwenden!
  end;

und irgendwo im Klassenquelltext kann es z.B. so aufgerufen werden:
ausblenden Delphi-Quelltext
1:
2:
  if Assigned(FErrorEvent) then
    FErrorEvent(Self, 1);


Alstar

Quelltext ungetestest
ghost_assassin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 18



BeitragVerfasst: Di 07.02.06 18:13 
füg doch einfach den parameter
oben bei procedure ein
ausblenden Delphi-Quelltext
1:
procedure TForm1.Button2Click(Sender: TObject; aCaption:String);					


das musste nur bei interface/type und
bei procedure direkt eintragen...

wenn du kompillieren willst kommt noch
ein hinweis, den du guten gewissens
mit ja bestätigen kannst...