Autor Beitrag
Tristan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 106



BeitragVerfasst: Mi 21.09.05 18:25 
Hallo,

ich habe ein simples Problem das sich dadurch gestaltet, dass ich eine Prozedur in einer neuen Unit aufrufen möchte.

ich habe versucht Unit2 bei uses einzubinden und die in Unit 2 mit type declarierte Prozedur aufzurufen. Jecoch scheitert die Einbinung, da die Prozedur nicht ansprechbar ist. Auch über die Autvervollständigungsfunktion ist kein Aufruf möglich.

Wie kann man denn eine Prozedur einer anderen Unit aufrufen?

Danke im Vorraus
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Mi 21.09.05 21:15 
zeug uns doch mal den Quelltext, dann kann man dir auch besser helfen.

_________________
In the beginning was the word.
And the word was content-type: text/plain.
rochus
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 416

Win XP Prof, Fedora Core 4, SuSE 7.0
D7 Ent, D2005 Pers
BeitragVerfasst: Do 22.09.05 09:47 
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:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
{ UNIT 1 ---------------------------------------------------------}
unit Unit1;

interface

uses
  { ... };

implementation

uses
  Unit2;

procedure MeineProzedurAusUnit1;
begin
  MeineProzedurAusUnit2;
  { alternativ, um zu wissen, dass es aus unit 2 kommt:
  Unit2.MeineProzedurAusUnit2; }

end;

end.

{ UNIT 2 ---------------------------------------------------------}
unit Unit2;

interface

uses
  { ... };

{ deklaration "nach außen", damit unit 1 die prozedur kennt }
procedure MeineProzedurAusUnit2;

implementation

{ implementierung der ProzedurAusUnit2 }
procedure MeineProzedurAusUnit2;
begin
  ShowMessage('Yeeha baby, es klappt!');
end;

end.



Ich verstehe nicht, wo du ein type benötigst?! wenn es bei dir so aussieht:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
unit Unit2;

interface

uses
  { ... };

type
  TMeineProzedurAusUnit2 = procedure;

{...}


dann hast du den Typ deiner Prozedur deklariert, sprich wie sie aufgebaut ist.

Gruß