Problème passage d'un paramètre procédural
Ce pb est résolu.
La cause: Une déclaration de TPoint2DDepth dans une unité et la même déclaration dans une autre. Centraliser les déclarations de types
Bjr,
Soient les types suivants:
Code:
1 2 3 4
|
// fonction de transformation 3D -> 2D
type TProcOfObjectProjTPoint3DfTo2d = function(const QP: TPoint3Df): TPoint2DDepth of object;
type TProcOfObjectProjPtXYZto2d = function(const QX, QY, QZ: double): TPoint2DDepth of object; |
Soient les fonctions déclarées dans un descendant TFrame appelé TCdrVisualisateur3DGDI
Code:
1 2 3
|
function Get2DDepthCoordinatesFromP3D(const QP: TPoint3Df): TPoint2DDepth;
function Get2DDepthCoordinatesFromXYZ(const QX, QY, QZ: double): TPoint2DDepth; |
J'ai créé un conteneur TListeTubesVisees qui comporte la fonction d'assignation (publique). Ce conteneur est hébergé par TCdrVisualisateur3DGDI:
Code:
1 2
|
procedure SetFunctionProjection(const FXYZ: TProcOfObjectProjPtXYZto2d); |
.
Lorsque je tente d'assigner dans une instance de TListeTubesVisees la fonction TCdrVisualisateur3DGDI.Get2DDepthCoordinatesFromXYZ:
Code:
1 2
|
FListeTubesVisees.SetFunctionProjection(self.Get2DDepthCoordinatesFromXYZ); |
; ce fdp de compilateur me jette avec l'erreur suivante:
Code:
1 2
|
cadrevisualisateur3dgdi.pas(194,73) Error: Incompatible type for arg no. 1: Got "TCdrVisualisateur3DGDI.Get2DDepthCoordinatesFromXYZ(const Double;const Double;const Double):<record type>;", expected "<procedure variable type of function(const Double;const Double;const Double):<record type> of object;Register>" |
Première fois que je vois çà.