Autor Beitrag
Barret
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 156
Erhaltene Danke: 1

Win XP
D7 Ent
BeitragVerfasst: Mi 26.05.04 09:28 
kann mir jemand sagen wie ich eine Variable übergreifend von Form zu Form änder kann?
sprich ich will bei einem Ereigniss in einer Form den Zustand einer Variblen in einer andern Form ändern.

_________________
Wir könnten ja, wenn wir wollten aber wir wollen ja nicht.
It´s not a bug, it´s a feature.
neojones
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1206
Erhaltene Danke: 1



BeitragVerfasst: Mi 26.05.04 09:37 
Ein Form hat keine Variablen, sondern die Unit.

Du bindest die Unit in der Du die Variable ändern willst im "uses"-Bereich der ersten Unit ein und machst dann Unit2.Variablenname := 'DeinWert';

Viele Grüße,

Matthias

_________________
Ha! Es compiliert! Wir können ausliefern!
FaTaLGuiLLoTiNe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 200
Erhaltene Danke: 5

Windows 7, Windows 8.1
Delphi XE
BeitragVerfasst: Mi 26.05.04 10:35 
Wenn ich das richtig verstanden habe, haben Forms durchaus Variablen. Sie heissen aber Attribute, da die Form ja eine Klasse bzw. ein Objekt einer Klasse ist. Auf ein solches Feld kannst du dann mit
ausblenden Delphi-Quelltext
1:
Form2.Variablenname := 'DeinWert';					

zugreifen.

In den Units kann man V. zwar auch deklarieren, aber ich lese hier immer wieder (und mache es auch selber so), dass man möglichst die Variablen im private bzw. public Bereich des Formulars deklarieren sollte.

_________________
<< FaTaLGuiLLoTiNe >>
Rhinoceroses don't play games!