Autor Beitrag
Dr. Phil
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 66

Win XP
Delphi 7 Prof.
BeitragVerfasst: Do 15.07.04 16:14 
Hallo,

ich habe in einer Unit eine Prozedur "Blubb".
Ich hab diese Unit (Sie heisst Blobb) im Projekt eingebunden:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
program test;

uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1},
  Blobb in '../Blobb.pas'; // Eine Ebene höher

{$R *.res}

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.

So.
Jetzt will ich von Unit 1 aus die Prozedur Blubb in der Unit Blobb aufrufen.
Die Unit Blobb schaut jetzt so aus:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
unit Blobb;

interface

uses
  FileCtrl, SysUtils, ShellAPI, Classes;

implementation

procedure Blubb;
begin
  ShowMessage('Blubb!');
end;

So und jetzt hab ich auf Unit1 geklickt -> Datei - Unit einbinden - "Blobb".

Wenn ich jetzt eine ButtonClick Prozedur erstelle, und mit Blobb.Blubb die prozedur aufrufen will, kommt der Fehler "unbekannter Bezeichner", also hat er die Unit anscheinend nicht gefunden.
Obwohl ich doch alles richtig eingebunden habe.

Ich blick bei den Units irgendwie nicht durch, da gibts immer irgendwelche Fehler, und immer kurz vorm Schluss :wink:

_________________
self-improvement is masturbation;
self-destruction is the answer - Tyler Durden
grayfox
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 800

win98, winXP
D4 Standard; D6 Personal
BeitragVerfasst: Do 15.07.04 17:39 
hallo doc!

ganz einfach - deine procedur wird nicht gefunden, da sie nicht im interface der unit deklariert ist und somit nur in der entsprechenden unit selbst verwendet werden kann.
machs so, dann klappts auch mit der procedure

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
unit Blobb;  
 
interface  
 
uses  
  FileCtrl, SysUtils, ShellAPI, Classes;  

procedure Blubb; <-- [neu !!!]
 
implementation  

procedure Blubb;  
begin  
  ShowMessage('Blubb!');  
end;


mfg, stefan
Dr. Phil Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 66

Win XP
Delphi 7 Prof.
BeitragVerfasst: Do 15.07.04 17:43 
Ach!
Stimmt ja! ich depp :roll:

Dankeschön :wink:

_________________
self-improvement is masturbation;
self-destruction is the answer - Tyler Durden