Autor Beitrag
Black Lightning
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 69



BeitragVerfasst: Do 22.08.02 09:49 
Hallo,
ich habe eine procedure deklariert in der ein Parameter als var übergeben wird. Wenn ich dieses var weglasse, wird das Programm zwar compiliert, funktioniert aber nicht so wie es soll.
Wenn ich das var hinschreibe (sowohl in der deklaration als auch in der definition) dann kommt bei der Zeile, in der ich diese Procedure aufrufe eine Fehlermeldung: "Types of actual and formal var parameters must be identical"
Die Deklaration der Procedure sieht so aus:   procedure FormKoordinaten_lesen(var Form: TForm; out erfolg: boolean);

hat jemand eine Ahnung woran das liegen kann?
Wie gesagt, wenn ich das var aus der definition und deklaration entferne wirds compiliert.

gruß
Black Lightning

_________________
--erst programmieren, dann denken, dann debuggen--
bis11
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1247
Erhaltene Danke: 2

Apple Mac OSX 10.11

BeitragVerfasst: Do 22.08.02 10:26 
Die Anweisung Form : TForm ist ja auch ein Typ der feiniert wird und nicht eine Variable. Anderst kann ich mir das nicht erklären.
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Do 22.08.02 11:03 
Siehe Dir mal dieses Posting an: [url=www.auq.de/viewtopic.php?t=1292]
Stellt man bei einem Objekt ein VAR davor oder nicht[/url]

Gruß
Black Lightning Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 69



BeitragVerfasst: Do 22.08.02 13:10 
@bis11
das klingt nicht ganz unlogisch, schliesslich übergebe ich eine Instanz von TForm1, deklariert wurde aber der Typ TForm.
aber....
wenn ich die Deklaration von TForm in TOject abändere, bleibt der Fehler...ausserdem wird Form1 problemlos als Value Parameter übergeben, nur nicht als variable Parameter.

@Tino
der Thread hat mir nicht weitergeholfen, ich weiss was var bedeutet, nur weiss ich nicht warum der Fehler vom Compiler kommt...bzw was er genau zu beanstanden hat.

_________________
--erst programmieren, dann denken, dann debuggen--
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Do 22.08.02 13:59 
Black Lightning hat folgendes geschrieben:
nur weiss ich nicht warum der Fehler vom Compiler kommt...bzw was er genau zu beanstanden hat.

Die Fehlermeldung kommt wahrscheinlich deshalb weil Du eine Variable vom Type tForm1 (oder halt eine anderes Objekt welches von tForm abgeleitet ist) übergibst aber die Methode eine Variable vom Type tForm erwartet! Bei Varibablenparameter müssen die Typen Identisch sein!

Gruß
TINO
Black Lightning Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 69



BeitragVerfasst: Do 22.08.02 14:16 
kann man dann auch kein TObject übergeben, weil es zu allgemein ist?
Auf jeden Fall klappte es nicht, wie oben bereits geschrieben, die Form einfach als TObject zu übergeben.

gruß
B.L.

_________________
--erst programmieren, dann denken, dann debuggen--