Autor Beitrag
Jakob Schöttl
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 929
Erhaltene Danke: 1


Delphi 7 Professional
BeitragVerfasst: So 18.06.06 18:44 
Hallo,

Ich will eine globale Variable (vom Typ Object) irgendwo deklarieren, so dass sie in allen Units, sowie im Program sichtbar ist, so wie Application: TApplication.

Ist das möglich *hoff* ?

Danke schon mal im Voraus für eure Unterstützung.
Bernhard Geyer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 721
Erhaltene Danke: 3



BeitragVerfasst: So 18.06.06 19:58 
Freilich: Du mußt die Variable nur im Interface-Teil der Unit einfügen und überall diese Unit aufnehmen.

Ist bei TApplication genauso. Diese liegt in Forms.pas.
Jakob Schöttl Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 929
Erhaltene Danke: 1


Delphi 7 Professional
BeitragVerfasst: Mo 19.06.06 06:01 
Achso, is ja easy! Ich hab nicht daran gedacht, dass ich die variable auch in der Unit deklarieren kann. Hab erst mal bloß an den Typ gedacht!

Vielen Dank Bernhard!

Wenn wir grad dabei sind: Kann man im Program auch einen Interface-Abschnitt einbauen?

EDIT: Nein geht leider nicht. Wäre zwar praktisch find ich, aber man kann nicht alles haben. Danke noch mal.
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Mo 19.06.06 09:05 
Am Besten ist es, wenn du alle globalen Variablen in eine Unit auslagerst, welche du in alle Units einbindest, welche auf diese Variablen zugreifen sollen.

_________________
Markus Kinzler.
Jakob Schöttl Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 929
Erhaltene Danke: 1


Delphi 7 Professional
BeitragVerfasst: Mo 19.06.06 12:54 
Und meint ihr, es ist besser, wenn ich das Object dann in der finalization der selben Unit instantiiere, oder Manuell beim Programmstart z. B. OnCreate?