Autor Beitrag
rizor
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 209

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: Do 21.12.06 15:21 
Hi,

wie kann ich variablen definieren, die in anderen Units benutzt werden?
globale Variablen gehen nicht.
Leuchtturm
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1087

Win Vista, Knoppix, Ubuntu
Delphi 7 Pe, Turbo Delphi, C#(VS 2005 Express), (X)HTML + CSS, bald Assembler
BeitragVerfasst: Do 21.12.06 15:51 
Im public-Teil, wenn ich mich nicht täusche.

_________________
Ich bin dafür verantwortlich was ich sage - nicht dafür was du verstehst.
freak4fun
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 604
Erhaltene Danke: 4

Win 7 Pro
VS 2013 Express, Delphi, C#, PHP, Java
BeitragVerfasst: Do 21.12.06 16:04 
user profile iconLeuchtturm hat folgendes geschrieben:
Im public-Teil, wenn ich mich nicht täusche.


Wenn die Variable im Publicteil liegt, muss man sich erst eine Klassenvariable anlegen.
Wenn die Variable auch ohne Klasseninstanz erreichbar sein soll, muss sie Superglobal sein, also da wo sonst die Form-Variable steht. Finde ich aber sehr unschön.

MfG
freak

_________________
"Ich werde auf GAR KEINEN Fall…!" - "Keks?" - "Okay, ich tu's."
i++; // zaehler i um 1 erhoehen
rizor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 209

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: Do 21.12.06 18:08 
also muss ich dann oop programmieren?
wie funktioniert das genau mit der klassen variable?
rizor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 209

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: Do 21.12.06 19:04 
Kann ich auch einfach das edit (das in der variablen gespeichert wird)
In jeder Unit nehmen?
Raffo
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 300



BeitragVerfasst: Do 21.12.06 19:54 
ganz einfach wenn du in public deklarierst rufst du auf z.b. meineform.meinevar:=1
rizor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 209

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: Fr 05.01.07 18:03 
das Problem ist, dass ich die Variable aus der einen Unit nehme und die variable dann bearbeite bekomme ich eine veränderte Variable heraus.
Diese muss wieder in die unit aus der die erste variable kommt.
dann bekomme ich die meldung das meine hauptunit eine zirkuläre unit ist.
Heiko
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3169
Erhaltene Danke: 11



BeitragVerfasst: Fr 05.01.07 18:38 
Dann musst du probieren, dass du die andere Unit einmal oben im Interface einbindest und in der anderen Unit die Unit im Implementationbereich.
Grenzgaenger
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Fr 05.01.07 18:42 
einfach im interface teil deklarieren und die unit einbinden. dann kannste drauf zugreifen.
rizor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 209

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: Sa 06.01.07 01:05 
Hab es verstanden.
Vielen Dank.
rizor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 209

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: Sa 06.01.07 15:47 
Wann muss ich uses in den Interface-Teil und wann in den Implementation-Teil schreiben?