Autor Beitrag
>M@steR<
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 288
Erhaltene Danke: 3



BeitragVerfasst: So 11.10.09 16:25 
Gelöscht


Zuletzt bearbeitet von >M@steR< am Di 17.09.13 02:28, insgesamt 1-mal bearbeitet
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: So 11.10.09 16:35 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
type
  TMyEvent = procedure(Sender: TObject; Param: stringof object;

  TBla = class
  private
    FMyEvent: TMyEvent;
  public
    property OnMyEvent: TMyEvent read FMyEvent write FMyEvent;
  end;

  TBle = class
  private
    FBla: TBla;
    procedure BlaMyEvent(Sender: TObject; Param: string);
  end;

...

procedure TBle. ...
begin
  FBla.OnMyEvent := BlaMyEvent;
end;
Als Variable in einer Unit geht es analog, auch wenn es sich nicht gerade nach sauberer Programmierung anhört.
>M@steR< Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 288
Erhaltene Danke: 3



BeitragVerfasst: So 11.10.09 18:44 
Gelöscht


Zuletzt bearbeitet von >M@steR< am Di 17.09.13 02:28, insgesamt 1-mal bearbeitet
dummzeuch
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 593
Erhaltene Danke: 5


Delphi 5 ent, Delphi 6 bis Delphi XE8 pro
BeitragVerfasst: So 11.10.09 20:46 
user profile iconjaenicke hat folgendes geschrieben:
Als Variable in einer Unit geht es analog, auch wenn es sich nicht gerade nach sauberer Programmierung anhört.


nur der Vollstaendigkeit halber:

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
unit MyUnit1;

interface

type
  TMyProc = procedure(_Param1, _Param2: integer; var _Param3: string);

var
  MyProc: TMyProc = nil;

implementation

procedure doMyProc(_Param1, _Param2: integer; var _Param3: string); inline;
begin
  if not Assigned(MyProc) then
    raise exception.Create('MyProc nicht zugewiesen');
  MyProc(_Param1, _Param2, _Param3);
end;

procedure WasAuchImmer;
var
  eins, zwei: ingeger;
  drei: integer;
begin
  eins := 1;
  zwei := 2;
  drei := 'drei';
  doMyProc(eins, zwei, drei);
end;

end;


Wieso das keine saubere Programmierung sein soll, verstehe ich nicht. Es ist halt nicht objektorientiert, das ist aber auch schon alles.

twm