Autor Beitrag
Andreas L.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Sa 15.11.03 12:21 
Hi,
ich habe auf meinen Form ein Edit, jetzt möchte ich die datei die im edit steht (z. B. hallo.pas) mit einen Include-Befehl in das Programm einfügen.

Der Befehl für includen ist: {$I ''} Zwischen die '' müsste eigentlich der Pfad mit dateiname, möchte aber das edit rein haben. Der Compiler wills dann aber nicht kompilieren, außerdem soll das erst included werden wenn ein Button gedrückt wird.

Mein Code beim Button is:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
begin
if not Edit1.text =(''then
begin
 //Da muss included werden
end
else
begin
ShowMessage('blabla');
end;
end;


Hoffe das mir jemand helfen kann.

Greetz
maximus
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 896

Win XP, Suse 8.1
Delphi 4/7/8 alles prof
BeitragVerfasst: Sa 15.11.03 12:29 
Du bist lustig :D

Das ist eine kompiler directive, die beim kompilieren ausgeführt wird und wären dessen kannst du wohl kaum einen button drücken, da das programm ja noch nicht läuft...wenn das ginge könntest du auch leicht ein rekursives paradoxon erzeugen :wink:

cui.

_________________
mfg.
mâximôv
Andreas L. Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Sa 15.11.03 12:54 
Aha, dann habe ich mir das falsch vorgstellt. Gibt es eine Möglichkeit eine Datei die Pascal-Code enthält während der Laufzeit auszuführen?
AndyB
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1173
Erhaltene Danke: 14


RAD Studio XE2
BeitragVerfasst: Sa 15.11.03 13:28 
Ja. Das nennt sich interpretieren. Da Delphi kein Interpreter ist, musst du dir da schon eine Unit/Komponente suchen, die einen Delphi-Interpreter implementiert. Z.B. JvInterpreter aus der JVCL.

_________________
Ist Zeit wirklich Geld?
Andreas L. Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Sa 15.11.03 13:40 
AndyB hat folgendes geschrieben:
Ja. Das nennt sich interpretieren. Da Delphi kein Interpreter ist, musst du dir da schon eine Unit/Komponente suchen, die einen Delphi-Interpreter implementiert. Z.B. JvInterpreter aus der JVCL.


Den JvInterpreter hab ich, wie fungiert der?
AndyB
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1173
Erhaltene Danke: 14


RAD Studio XE2
BeitragVerfasst: Sa 15.11.03 13:53 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
uses
  JvInterpreter, { Interpreter Komponente }
  JvInterpreter_All; { die meisten VCL Funktionen/Klassen verfügbar machen }

var
  Prog: TJvInterpreterProgram;
begin
  Prog := TJvInterpreterProgram.Create(nil);
  try
    Prog.Pas.Text := 
      'program Test;'#10 +
      'begin'#10 +
      '  ShowMessage(''Hallo'');'#10 +
      'end.';

    Prog.Run;

  finally
    Prog.Free;
  end;
end;

_________________
Ist Zeit wirklich Geld?
Andreas L. Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Sa 15.11.03 19:52 
OK, wie mache ich das der Code aus ner datei geladen wird?
AndyB
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1173
Erhaltene Danke: 14


RAD Studio XE2
BeitragVerfasst: Sa 15.11.03 20:05 
Prog.Pas ist eine TStringList.

_________________
Ist Zeit wirklich Geld?
Andreas L. Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Sa 15.11.03 21:37 
AndyB hat folgendes geschrieben:
Prog.Pas ist eine TStringList.


Geht da LoadfromFile oder muss ich den code vorher in ein Memo laden und dann Prog.Pas.text :=Memo1.text;?

Greetz und danke für eure antworten.
Andreas L. Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Sa 15.11.03 22:45 
Das Projekt lässt sich nicht kompilieren, da ich eine DB.dcu benötige. Hab ich aber nicht da ich keine Datenbank-Unterstützung in meinen Delphi habe.
AndyB
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1173
Erhaltene Danke: 14


RAD Studio XE2
BeitragVerfasst: So 16.11.03 01:53 
Dann schau dir mal die JVCL 3 an. Diese hat Personal Edition Packages. Dazu musst du aber vor derm Kompilieren der JVCL 3 in der Datei common\jvcl.inc die Zeile
ausblenden Quelltext
1:
{.$DEFINE DelphiPersonalEdition}					

in
ausblenden Quelltext
1:
{$DEFINE DelphiPersonalEdition}					

(Punkt nach derm "{" entfernt) abändern.


Alternativ kannst du auch alle DB abhänigen Units und RegisterJvInterpreterAdapter auskommentieren.


Zitat:
Geht da LoadfromFile oder muss ich den code vorher in ein Memo laden und dann Sourcecode:
Prog.Pas.text :=Memo1.text;

Ahhhhh. Das ist ja wie: Ich möchte von München nach Berlin. Dazu fahre ich erst nach Frankfurt, fliege dann nach SF, weiter nach Atlanta, dann einen Zwischenstopp in Brasilien und weiter nach Sidney. Nun geht es nach Tokio und dann nach Honkkong. Nach einer kleinen Verschnaufpause mache ich mich nun auf den Weg nach Moskau. Von dort kann ich nun nach Berlin.

Memo1.Lines ist von Typ TStrings. JvInterpreter.Pas ist vom Typ TStrings. Warum sollten beide Eigenschaften also andere Methoden haben, wenn sie doch gleich sind?

_________________
Ist Zeit wirklich Geld?
Andreas L. Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: So 16.11.03 10:51 
Wusste gar nicht das es schon die JVCL3 gibt, hab noch die 2te. Werde das mal probieren und mich dann wieder melden. Danke an alle...
AndyB
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1173
Erhaltene Danke: 14


RAD Studio XE2
BeitragVerfasst: So 16.11.03 11:23 
Die gibt es schon länger. Sie ist aber noch nicht fertig. Laut Aussagen der Entwickler der JVCL soll sie erst im Januar released werden.

_________________
Ist Zeit wirklich Geld?
Andreas L. Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Mo 12.01.04 19:39 
AndyB hat folgendes geschrieben:
Dann schau dir mal die JVCL 3 an. Diese hat Personal Edition Packages. Dazu musst du aber vor derm Kompilieren der JVCL 3 in der Datei common\jvcl.inc die Zeile
ausblenden Quelltext
1:
{.$DEFINE DelphiPersonalEdition}					

in
ausblenden Quelltext
1:
{$DEFINE DelphiPersonalEdition}					

(Punkt nach derm "{" entfernt) abändern.



Das habe ich alles gemacht. Geht aber net, ich müsste dazu die ganzen Proceduren und Functionen in der JvInterpreter_db.pas aus kommentieren.

Wie jetzt weiter?
Böser Borstel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 154



BeitragVerfasst: Di 13.01.04 16:29 
suche im delphiverzeichnis nach db.dcu und kopiere diese in dein programmverzeichnis, probiere die kompilierung erneut.
grayfox
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 800

win98, winXP
D4 Standard; D6 Personal
BeitragVerfasst: Di 13.01.04 18:43 
ist nicht bei der PersonalEdition selten eine DB.DCU dabei? :wink:
Böser Borstel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 154



BeitragVerfasst: Mi 14.01.04 08:06 
das weiß ich nicht, bei meiner Delphi 5 Enterprice Version ist sie dabei.
grayfox
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 800

win98, winXP
D4 Standard; D6 Personal
BeitragVerfasst: Mi 14.01.04 18:33 
ok, dann weisst du es jetzt ;)
nein, die PersonalEditions sind 'sparversionen' ohne DB-Komponenten

mfg, stefan