I have an application that I am building, that has a PageControl with several created TabSheets, on which I place on of several pre-defined frames. There is a routine in each frame called “GetValue” that parses the contents of it’s controls into a string and returns the result. On the main form (RGMain) I have:
Type
TGetValueFunction = Function: String;
...
Private
fGetValueFunction: TGetValueFunction;
...
Public
Property GetValueFunction: TGetValueFunction Write fGetValueFunction;
In each of the Frames I have:
Public
Constructor Create(AQwner: TComponent);
...
Interface
Constructor TBooleanChoiceFrame.Create(AOwner: TComponent);
Begin
Inherited Create(AOwner);
RGMain.GetValueFunction := GetValue; <<<< compile error on this line
End;
E2009 Incompatble types: ‘regular procedure and method pointer’
Beyond correcting the problem, is this even the correct way to solve the problem of getting access to the GetValue routine in each frame?
If you want to use methods of a class you have to declare the function type like this: