Autor Beitrag
Morpheus1572
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 157

Win XP
Delphi 7
BeitragVerfasst: Sa 15.11.08 17:43 
Hi Leutz,

ich komm nicht auf das wort und somit auch nicht auf die möglichkeit danach effektiv zu suchen... Folgendes Problem:

Ich habe einen bestimmten Codeschnipsel, der für sich alleine gesehen nicht lauffähig ist. Z.B. der Aufbau eines Briefkopfes, den ich immer dann in meinen Code einbinden möchte, wenn ich eine neue seite aufmache.

als procedure würde das gehen ist aber ne menge aufwand, da ich gehörig viele variablen durch die gegend schubse.

was ich suche ist die möglichkeit zu sagen: Hey programm, jetzt nimmst du mal diese codezeilen, implementierst sie genau hier und machst weiter als hätten die da immer gestanden.

und an einer anderen stelle kann ich dann genau das gleiche sagen... nur weiß ich nicht ob das in delphi so geht und wenn ja wie...

Thx Morph.
ub60
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 764
Erhaltene Danke: 127



BeitragVerfasst: Sa 15.11.08 17:57 
Suchst Du "include"?

ub60
Morpheus1572 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 157

Win XP
Delphi 7
BeitragVerfasst: Sa 15.11.08 18:01 
hab kurz mal nachgeschlagen. in wie fern könnte mir das bei meinem problem helfen?

ich meine wie soll ich das anwenden (Befehlstechnisch)?

include procedure oder wie?
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19325
Erhaltene Danke: 1749

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 15.11.08 18:08 
ausblenden Delphi-Quelltext
1:
2:
{$include xyz} // wird automatisch als xyz.pas angesehen
{$include xyz.inc}
Und in diese andere Datei schreibst du deinen Code.
DeddyH
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Sa 15.11.08 18:10 
Wobei ein solches Design in meinen Augen suboptimal erscheint.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19325
Erhaltene Danke: 1749

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 15.11.08 18:12 
Es ist auch nicht besonders sinnvoll, da man das auch mit einem objektorientierten Ansatz viel besser erreicht normalerweise, aber naja, er muss es ja wissen... wenn er das so machen will...
MagicRain
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 154

WinXp, Win8, iOS
Delphi 7, Lazarus Pascal, Delphi 10.2 Starter, NetBeans Java
BeitragVerfasst: Sa 15.11.08 18:39 
Also wenn ich mich nicht total täusche dann würde das doch mit einer
function gut klappen oder liege ich da falsch? :D
Morpheus1572 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 157

Win XP
Delphi 7
BeitragVerfasst: Sa 15.11.08 18:45 
okay, verstehe schon.

dann werde ich es mal mit einer function probieren. thx @ all.
DeddyH
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Sa 15.11.08 18:45 
Kommt auf den Einzelfall an. Möglich wäre z.B. eine Unit mit allgemeingültigen nützlichen Prozeduren/Funktionen, eine Methode des Formulars oder eine eigene Klasse, die diese Methode implementiert.
Morpheus1572 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 157

Win XP
Delphi 7
BeitragVerfasst: Mi 19.11.08 16:35 
ist alles nicht das was ich suche. okay, dann eben über funktionen oder umgeschriebenen proceduren. thx.