MedHome
MedHome

Reputation: 1

I got Runtime Error with my sample project using freepascal and concerning casting tform and using virtual method

This sample use 2 forms
1 BaseForm (TFORM)
2 TF1 (BaseForm) inherited

BaseForm has the procedure
Procedure whenDeleteRec(dataset:tdataset) virtual;Abstract

TF1
Procedure whenDeletedRec(dataset:tdataset); override;

Now in the MainForm when I do baseform (p).WhenDeletedRec(dataset) where p is a pointer to tf1 I got a runtime error.

Regards
Med

Upvotes: 0

Views: 31

Answers (1)

Marco van de Voort
Marco van de Voort

Reputation: 26376

You give very little information. Based on the information that you give, I'd say It that you cast a pointer to a form to a form

Try dereferencing the pointer first:

baseform(p^).whendeletedrec(dataset);

Upvotes: 0

Related Questions