Autor Beitrag
popi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 26



BeitragVerfasst: Sa 10.06.06 08:18 
Hallo zusammen,

ich muß in meinem Programm eine Procedur aufrufen.
Jetz habe ich das mit Graph(); probiert, ging aber nicht.
Dann habe ich Graph(nil); probiert und das ging.

Ich verstehe nicht so ganz denn Sinn von diesem nil.

Könnt Ihr mir bitte einen Satz dazu schreiben, damit meine Unkenntnis beseitigt wird ;o)

Danke im voraus

MfG

popi
Beiri22
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 42



BeitragVerfasst: Sa 10.06.06 08:26 
Die Prozedur wird als Parameter einen Pointer(Zeiger) erwarten, den du mit nil übergibst (Nil heißt soviel wie: zeigt nirgendwo hin).

Kannst du mal die Prozedur, die du aufrufst oder wenigstens deren Kopfzeile schicken?
popi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 26



BeitragVerfasst: Sa 10.06.06 08:34 
Titel: Gerne, hier die Kopfzeile...
Procedure TForm1.Graph(Sender: TObject);

die Procedur an sich ist ziemlich lang, deswegen poste ich mal nur die Kopfzeile.

Wozu der Zeiger?
Ist es nicht klar definiert, wenn ich die Procedur starte?
Der Anfang der Procedur steht doch auf eine bestimmte Adresse. Wird diese nicht mit dem Procedurnamen schon definiert?
Oder habe ich denn Sinn des Zeigers mißverstanden?

Danke und Grüße

popi
Beiri22
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 42



BeitragVerfasst: Sa 10.06.06 08:38 
ausblenden Delphi-Quelltext
1:
Procedure TForm1.Graph(Sender: TObject);					


Die Prozedur erwartet ein TObjekt als 1. Parameter;
Du hast aber keit TObjekt, dass du übergeben willst.
(Kann auch sein, dass das TObjekt garnicht verwendet wird(innerhalb der procedure), ist als standard, dass der Sender übergeben wird, der normalerweise ein TObjekt angibt, dass die Procedur aufruft).
Du übergibst also Nil, um zu zeigen, dass du kein TObjekt übergibst.
popi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 26



BeitragVerfasst: Sa 10.06.06 08:43 
Titel: Okay, ich glaube, ich habs verstanden...
die Procedur erwartet einen Wert, aber da ich keinen übergebe, muss ich dies auch mitteilen, also mit "nil".

Vielen Dank für die schnelle Antwort.

Liebe Grüße

popi
Beiri22
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 42



BeitragVerfasst: Sa 10.06.06 08:54 
Eins noch: Würde sie einen Integer oder so erwarten, geht nil nicht, da kommt dann ein fehler.
popi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 26



BeitragVerfasst: Sa 10.06.06 08:59 
Titel: Danke nochmal für die Zusatzinfo...
Liebe Grüße

popi