Autor Beitrag
moelski
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 60

XP
D6 Prof.
BeitragVerfasst: Fr 27.08.04 06:53 
Hallo !

Situation: Ich habe ein Form mit einem Button. Dazu etwas Code für den Button der z.B. eine Messagebox öffnet (ála HelloWorld).
Ist es möglich den Code für den Button in eine separate Unit auszulagern und wenn ja wie?


Moderiert von user profile iconKlabautermann: Topic aus Sonstiges verschoben am Fr 27.08.2004 um 10:29

_________________
Grüße Moelski
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Fr 27.08.04 07:47 
Hallo!

Du erstellst eine neue Unit und in dieser eine neue Proceudure die du z. b. MeineProcedure nennst.

Im OnClick Event des Buttons rufst du dann einfach deine neue Procedure auf:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
Uses
  MeineUnit;

{...}

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

Gruß
Tino
moelski Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 60

XP
D6 Prof.
BeitragVerfasst: Fr 27.08.04 07:58 
Moin !

@Tino:
Ok, das ist eine Möglichkeit. Aber was ich ja erreichen will ist ja das Abspecken der "Hauptunit". Und so muss ich ja doch wieder eine Procedure einbinden.

Gibt es da nicht noch andere Möglichkeiten? Evtl. irgendeine Linkeroption die einen Quelltextbereich vor dem Compilieren in die PAS Datei wieder einsetzt.

_________________
Grüße Moelski
moelski Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 60

XP
D6 Prof.
BeitragVerfasst: Fr 27.08.04 09:24 
Moin !

Ich habe es rausgefunden. Geht ganz easy über
ausblenden Delphi-Quelltext
1:
$I PAS-Datei					

_________________
Grüße Moelski