Autor Beitrag
Borlox
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 191

Win XP
Delphi 6 Enterprise
BeitragVerfasst: Di 20.08.02 16:52 
:?: Hi Leutz könnt mir vielleicht einer von euch tellen wie ich das machen kann?
Konnte in der FAQ nichts finden. :(
thx
Deykin11
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Di 20.08.02 17:07 
Wenn Du das meinst was ich denke machst du das so:

1. Funktion in der neuen Unit:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
fuction Twieauchimmer.Datenuebergeben(str1,str2:string;num1,num2:integer);
begin
  //alle folgenden Variablen müssen vorher global deklariert werden
  ersteVariable := str1;  //Globaler Variable in der neuen Unit wird der übergeben Wert zugewiesen
  zweiteVariable := str2;
  dritteVariable := num1;
  vierteVariable := num2;
end;



2. Aufruf der Function in Deiner HauptUnit:
ausblenden Quelltext
1:
TWieauchimmer.Datenuebergeben(E1.text,E2.text, strtoint(E3.text),strToInt(e4.text));					
Borlox Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 191

Win XP
Delphi 6 Enterprise
BeitragVerfasst: Di 20.08.02 17:17 
Nein so mein ich das nicht ganz.
Ich hab eine Variable in Unit1 und die bekommt dort einen wert zu gewiesen. und ich möchte in Unit2 diese Variable wieder aurufen und sie soll immer noch den Wert haben den Sie in Unit1 bekommen hat.
neojones
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1206
Erhaltene Danke: 1



BeitragVerfasst: Di 20.08.02 17:31 
In Unit1:

ausblenden Quelltext
1:
VariablenName := Wert;					


In Unit2 die Unit1 im Uses-Abschnitt einbinden und dann:

ausblenden Quelltext
1:
ShowMessage(Unit1.VariablenName);					

_________________
Ha! Es compiliert! Wir können ausliefern!

Für diesen Beitrag haben gedankt: Chronm
Borlox Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 191

Win XP
Delphi 6 Enterprise
BeitragVerfasst: Di 20.08.02 17:40 
Das hab ich auch schon probiert alerdings erhalte ich immer folgenede Fehlermeldung: [Fehler] Unit2.pas(xx): Undefinierter Bezeichner: VariabelName .
Ich hoffes es ist klar das dies nürlich eine eins zu eins kopie ist.
neojones
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1206
Erhaltene Danke: 1



BeitragVerfasst: Di 20.08.02 17:42 
Voraussgesetzt Du hast alles Richtig geschrieben, kommt es natürlich auf die Art der variablendeklaration an. Evtl. musst Du auch schreiben

Unit1.Form1.Variablenname

Gruß,

Matthias

_________________
Ha! Es compiliert! Wir können ausliefern!
Borlox Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 191

Win XP
Delphi 6 Enterprise
BeitragVerfasst: Di 20.08.02 17:48 
:D :D :D Fett Danke jetzt gehts alles klar jetzt funzt.

thx
DeCodeGuru
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1333
Erhaltene Danke: 1

Arch Linux
Eclipse
BeitragVerfasst: Di 20.08.02 18:16 
Hi,

wenn ich Variablen in anderen Units verwenden will, so deklariere ich sie in den Publicteil. Dann erspar ich mir das Unit1.Form1.Variablename :mrgreen:

_________________
Viele Grüße
Jakob