Autor Beitrag
ByteKiller
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 32

Win Vista, XP Pro SP2
Delphi 7 (Delphi 2005)
BeitragVerfasst: Fr 09.06.06 15:19 
Hi Leute,

ich möchte in einer "zweite Unit" (unabhängig von irgendeiner Form) alle
meine selbst geschriebenen Proceduren reinlegen. Wenn ich jetzt aus der
ersten Unit eine Procedur starten will funzt das net obwohl ich die
"zweite Unit" mit uses eingebunden habe...
Könnt ihr mir da helfen?
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Fr 09.06.06 15:24 
Hast Du sie auch im interface-Teil deklariert? Zeig mal ein wenig Code ...
fidionael
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 232

Win XP SP2, Ubuntu 6.06
Delphi 7 PE, Delphi 3 Prof
BeitragVerfasst: Fr 09.06.06 15:26 
Was funktioniert wäre die Benutzung einer Include-Datei oder auch die einer DLL

Benutzung von Include-Dateien:
ausblenden beispiel.inc
1:
2:
3:
4:
function Add(a,b: Integer) : Integer;
begin
  Result:=a+b;
end;


ausblenden Unit1.pas
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

{$I beispiel.inc}

end.


Für die Benutzung von DLLs schaust du dir am besten mal ein Tutorial an, da gibt's etliche.

Noch eine Möglichkeit, allerdings klingt es nicht so, als würdest du sie momentan brauchen, wäre die OOP (Objektorientierte Programmierung), für welche es auch unzählige gute Tutorials im Netz gibt.

Mfg
ByteKiller Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 32

Win Vista, XP Pro SP2
Delphi 7 (Delphi 2005)
BeitragVerfasst: Fr 09.06.06 15:35 
Bsp. für Unit1:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
implementation

uses unit2;

procedure TForm1.Button1Click(Sender: TObject);
begin
  neu;
end;


Bsp. für Unit2:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
unit unit2;

interface

uses
  SysUtils, Dialogs;


implementation


procedure neu;
var ....;
begin
.
.
.
end;

end.
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Fr 09.06.06 15:37 
du musst
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:
unit unit2;

interface

uses
  SysUtils, Dialogs;

procedure neu;


implementation


procedure neu;
var ....;
begin
.
.
.
end;

end.

schreiben.

//EDIT: Is das jetz ne neue Abart des Highlighter-Bugs, oder is die schon bekannt?

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Fr 09.06.06 15:46 
hiho,
der grund, dass man oberhalb von implentation nochmals den procedure namen abgeben muss, ist der, dass alles, was nach implentation steht, nur unit-intern sichtbar ist! :P
ByteKiller Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 32

Win Vista, XP Pro SP2
Delphi 7 (Delphi 2005)
BeitragVerfasst: Fr 09.06.06 15:48 
:oops: THX :!: :!: