Autor Beitrag
jule1988
Hält's aus hier
Beiträge: 12



BeitragVerfasst: Do 23.11.06 18:29 
an welcher Stelle werden Prozeduren erstmals in einer Unit einefügt ,wo werden diese geschrieben und wie werden sie in dem Ablauf der Unit aktiviert?
wulfskin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1349
Erhaltene Danke: 1

Win XP
D5 Pers (SSL), D2005 Pro, C, C#
BeitragVerfasst: Do 23.11.06 18:42 
Der Prozedurkopf muss immer vor dem Aufruf bekannt sein, steht also davor, bei unitübergreifenden Prozeduren oberhalb von implementation. Aufgerufen werden diese durch den Prozedurnamen und die Parameterliste.

(Kein hallo, keine Freundlichkeit. Siehe Frage.)

_________________
Manche antworten um ihren Beitragszähler zu erhöhen, andere um zu Helfen.
Dragonclaw
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 196

Windows Vista
Delphi 7 Prof.
BeitragVerfasst: Do 23.11.06 18:47 
Also ganz oben findest du ja z. B. das hier

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject); // Prozedur Button1Click, also die Prozedur wenn Button 1 gedrück wird
    procedure Test;  //Eigene Prozedur
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;


dann wir die Prozedur er mal implementiert, das kommt NACH {$R *.dfm}
ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.Test;
begin
// Code kommt hier rein
end;


Die Prozedur kann man dann mit

ausblenden Delphi-Quelltext
1:
Test;					


Das wars
Manina
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 44

Win 7 Pro
RAD Studio 2010 Pro
BeitragVerfasst: Do 23.11.06 18:48 
1. Die Procedure-Sammlung:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
unit Sammlung;

interface

procedure TestProc;
function TestFunc : Integer;

implementation

procedure TestProc;
begin
...
end;

function TestFunc : Integer;
begin
  Result := 0;
end;

end.


2. Das Hauptprogramm:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
unit Main;

interface

uses Sammlung;

implementation

procedure Doit;
var i : Integer;
begin
  TestProc;
  i := TestFunc;
end;

end.


Damit dürfte das Prinzip klar werden, oder ? :wink:

_________________
Gates, oder Gates nicht ?
jule1988 Threadstarter
Hält's aus hier
Beiträge: 12



BeitragVerfasst: Do 23.11.06 18:56 
entschuldigung aber ich bin am Verzweifeln, weil ich morgen eine Informatik klausur schreibe und in Delphi-Theorie echt mieß bin also hier mein
"HALLO" und vielen dank für die Hilfe